Skip to content

Commit

Permalink
gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Jul 9, 2022
1 parent 0fc8ac0 commit 78307c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:meth:`SSLContext.set_default_verify_paths` now releases the GIL around
``SSL_CTX_set_default_verify_paths`` call. The function call performs I/O
and CPU intensive work.
6 changes: 5 additions & 1 deletion Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4302,7 +4302,11 @@ static PyObject *
_ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self)
/*[clinic end generated code: output=0bee74e6e09deaaa input=35f3408021463d74]*/
{
if (!SSL_CTX_set_default_verify_paths(self->ctx)) {
int rc;
Py_BEGIN_ALLOW_THREADS
rc = SSL_CTX_set_default_verify_paths(self->ctx);
Py_END_ALLOW_THREADS
if (!rc) {
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
return NULL;
}
Expand Down

0 comments on commit 78307c7

Please sign in to comment.