Skip to content

Commit

Permalink
closes bpo-31903: Release the GIL when calling into SystemConfigurati…
Browse files Browse the repository at this point in the history
…on (GH-4178)
  • Loading branch information
maxbelanger authored and benjaminp committed Sep 11, 2018
1 parent ec014a1 commit 4859ba0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid
deadlocks.
6 changes: 6 additions & 0 deletions Modules/_scproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 4859ba0

Please sign in to comment.