From aa12534acff4868f6dce9e2364a66fbb0ebcb3ca Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 12 Sep 2018 08:38:36 -0700 Subject: closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 4859ba0d2ce4506fddc3f55f90f8dce031b3804f) Co-authored-by: Max Bélanger --- Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst | 2 ++ Modules/_scproxy.c | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst 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 index 0000000..3788112 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst @@ -0,0 +1,2 @@ +In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid +deadlocks. diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c index 1ce4b77..e37515e 100644 --- a/Modules/_scproxy.c +++ b/Modules/_scproxy.c @@ -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_INCREF(Py_None); return Py_None; @@ -173,7 +176,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(); } -- cgit v0.12