]> granicus.if.org Git - python/commitdiff
closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)
authorMax Bélanger <aeromax@gmail.com>
Tue, 11 Sep 2018 23:14:00 +0000 (16:14 -0700)
committerBenjamin Peterson <benjamin@python.org>
Tue, 11 Sep 2018 23:14:00 +0000 (16:14 -0700)
Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst [new file with mode: 0644]
Modules/_scproxy.c

diff --git a/Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst b/Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst
new file mode 100644 (file)
index 0000000..3788112
--- /dev/null
@@ -0,0 +1,2 @@
+In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid
+deadlocks.
index 8861dc456d759aabba720929391f4e794e515801..dbee3f7367edeb0c397cceccb3b31d836ce4e62e 100644 (file)
@@ -62,7 +62,10 @@ get_proxy_settings(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
     PyObject* v;
     int r;
 
+    Py_BEGIN_ALLOW_THREADS
     proxyDict = SCDynamicStoreCopyProxies(NULL);
+    Py_END_ALLOW_THREADS
+
     if (!proxyDict) {
         Py_RETURN_NONE;
     }
@@ -172,7 +175,10 @@ get_proxies(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
     int r;
     CFDictionaryRef proxyDict = NULL;
 
+    Py_BEGIN_ALLOW_THREADS
     proxyDict = SCDynamicStoreCopyProxies(NULL);
+    Py_END_ALLOW_THREADS
+
     if (proxyDict == NULL) {
         return PyDict_New();
     }