closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)

(cherry picked from commit 4859ba0d2c)

Co-authored-by: Max Bélanger <aeromax@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-09-12 08:37:30 -07:00 committed by GitHub
parent cadb66e173
commit 72c34cf6dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,2 @@
In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid
deadlocks.

View 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();
}