diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-09 16:35:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 16:35:54 (GMT) |
commit | d4796c2231eef9355814572650f00c3c4662f197 (patch) | |
tree | 221df7b50748ef3561fdcadcdae787a75c24de91 | |
parent | da4912885f11f525a82a83f795ebffba06560e13 (diff) | |
download | cpython-d4796c2231eef9355814572650f00c3c4662f197.zip cpython-d4796c2231eef9355814572650f00c3c4662f197.tar.gz cpython-d4796c2231eef9355814572650f00c3c4662f197.tar.bz2 |
gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)
(cherry picked from commit 78307c7dc2352b6633138466debd4c10fae32970)
Co-authored-by: Christian Heimes <christian@python.org>
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-07-07-15-46-55.gh-issue-94637.IYEiUM.rst | 3 | ||||
-rw-r--r-- | Modules/_ssl.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-07-07-15-46-55.gh-issue-94637.IYEiUM.rst b/Misc/NEWS.d/next/Library/2022-07-07-15-46-55.gh-issue-94637.IYEiUM.rst new file mode 100644 index 0000000..20cbbcd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-07-07-15-46-55.gh-issue-94637.IYEiUM.rst @@ -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. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index c8500c5..51bb2d0 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -4305,7 +4305,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; } |