Skip to content

Commit aa12534

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 a00de68 commit aa12534

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_INCREF(Py_None);
6871
return Py_None;
@@ -173,7 +176,10 @@ get_proxies(PyObject* mod __attribute__((__unused__)))
173176
int r;
174177
CFDictionaryRef proxyDict = NULL;
175178

179+
Py_BEGIN_ALLOW_THREADS
176180
proxyDict = SCDynamicStoreCopyProxies(NULL);
181+
Py_END_ALLOW_THREADS
182+
177183
if (proxyDict == NULL) {
178184
return PyDict_New();
179185
}

0 commit comments

Comments
 (0)