diff options
author | Max BĂ©langer <aeromax@gmail.com> | 2018-09-11 23:14:00 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2018-09-11 23:14:00 (GMT) |
commit | 4859ba0d2ce4506fddc3f55f90f8dce031b3804f (patch) | |
tree | ae9ce3fc1f6308038166e017df148db9621c697f | |
parent | ec014a101a7f6243b95dfc08acfe1542b9fa5d39 (diff) | |
download | cpython-4859ba0d2ce4506fddc3f55f90f8dce031b3804f.zip cpython-4859ba0d2ce4506fddc3f55f90f8dce031b3804f.tar.gz cpython-4859ba0d2ce4506fddc3f55f90f8dce031b3804f.tar.bz2 |
closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)
-rw-r--r-- | Misc/NEWS.d/next/macOS/2017-11-01-16-53-12.bpo-31903.K6jCVG.rst | 2 | ||||
-rw-r--r-- | Modules/_scproxy.c | 6 |
2 files changed, 8 insertions, 0 deletions
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 8861dc4..dbee3f7 100644 --- a/Modules/_scproxy.c +++ b/Modules/_scproxy.c @@ -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(); } |