closes bpo-31903: Release the GIL when calling into SystemConfigurati… · python/cpython@aa12534 (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 +In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid
2 +deadlocks.
Original file line number Diff line number Diff line change
@@ -62,7 +62,10 @@ get_proxy_settings(PyObject* mod __attribute__((__unused__)))
62 62 PyObject* v;
63 63 int r;
64 64
65 +Py_BEGIN_ALLOW_THREADS
65 66 proxyDict = SCDynamicStoreCopyProxies(NULL);
67 +Py_END_ALLOW_THREADS
68 +
66 69 if (!proxyDict) {
67 70 Py_INCREF(Py_None);
68 71 return Py_None;
@@ -173,7 +176,10 @@ get_proxies(PyObject* mod __attribute__((__unused__)))
173 176 int r;
174 177 CFDictionaryRef proxyDict = NULL;
175 178
179 +Py_BEGIN_ALLOW_THREADS
176 180 proxyDict = SCDynamicStoreCopyProxies(NULL);
181 +Py_END_ALLOW_THREADS
182 +
177 183 if (proxyDict == NULL) {
178 184 return PyDict_New();
179 185 }