Skip to content

Commit 4859ba0

Browse files
maxbelangerbenjaminp
authored andcommitted
closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178)
1 parent ec014a1 commit 4859ba0

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* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
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* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
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)