gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)

This commit is contained in:
Christian Heimes 2022-07-09 18:11:15 +02:00 committed by GitHub
parent 0fc8ac0b0d
commit 78307c7dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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.

View File

@ -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;
}