Skip to content

Commit 78307c7

Browse files
authored
gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)
1 parent 0fc8ac0 commit 78307c7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:meth:`SSLContext.set_default_verify_paths` now releases the GIL around
2+
``SSL_CTX_set_default_verify_paths`` call. The function call performs I/O
3+
and CPU intensive work.

Modules/_ssl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4302,7 +4302,11 @@ static PyObject *
43024302
_ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self)
43034303
/*[clinic end generated code: output=0bee74e6e09deaaa input=35f3408021463d74]*/
43044304
{
4305-
if (!SSL_CTX_set_default_verify_paths(self->ctx)) {
4305+
int rc;
4306+
Py_BEGIN_ALLOW_THREADS
4307+
rc = SSL_CTX_set_default_verify_paths(self->ctx);
4308+
Py_END_ALLOW_THREADS
4309+
if (!rc) {
43064310
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
43074311
return NULL;
43084312
}

0 commit comments

Comments
 (0)