Skip to content

Commit 72c34cf

Browse files
closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)
(cherry picked from commit 4859ba0) Co-authored-by: Max Bélanger <[email protected]>
1 parent cadb66e commit 72c34cf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
In :mod:`_scproxy`, drop the GIL when calling into ``SystemConfiguration`` to avoid
2+
deadlocks.

‎Modules/_scproxy.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ get_proxy_settings(PyObject* mod __attribute__((__unused__)))
6262
PyObject* v;
6363
int r;
6464

65+
Py_BEGIN_ALLOW_THREADS
6566
proxyDict = SCDynamicStoreCopyProxies(NULL);
67+
Py_END_ALLOW_THREADS
68+
6669
if (!proxyDict) {
6770
Py_RETURN_NONE;
6871
}
@@ -172,7 +175,10 @@ get_proxies(PyObject* mod __attribute__((__unused__)))
172175
int r;
173176
CFDictionaryRef proxyDict = NULL;
174177

178+
Py_BEGIN_ALLOW_THREADS
175179
proxyDict = SCDynamicStoreCopyProxies(NULL);
180+
Py_END_ALLOW_THREADS
181+
176182
if (proxyDict == NULL) {
177183
return PyDict_New();
178184
}

0 commit comments

Comments
 (0)