]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 12 Sep 2018 15:37:30 +0000 (08:37 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Sep 2018 15:37:30 +0000 (08:37 -0700)
(cherry picked from commit 4859ba0d2ce4506fddc3f55f90f8dce031b3804f)

Co-authored-by: Max Bélanger <aeromax@gmail.com>
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 0e3b02879b833dc83645ad8a786f755e212e9ae8..c5660673c6357b6b35dfb99b95923c5ebec8bc8a 100644 (file)
@@ -62,7 +62,10 @@ get_proxy_settings(PyObject* mod __attribute__((__unused__)))
     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* mod __attribute__((__unused__)))
     int r;
     CFDictionaryRef proxyDict = NULL;
 
+    Py_BEGIN_ALLOW_THREADS
     proxyDict = SCDynamicStoreCopyProxies(NULL);
+    Py_END_ALLOW_THREADS
+
     if (proxyDict == NULL) {
         return PyDict_New();
     }