Skip to content

[3.15] gh-159811: Raise OpenSSL errors in _hashlib.HASH after re-attaching the thread state (GH-159817) - #159927

Merged
picnixz merged 1 commit into
python:3.15from
miss-islington:backport-6fa2d64-3.15
Oct 20, 2026
Merged

picnixz merged 1 commit into
python:3.15from
miss-islington:backport-6fa2d64-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

When EVP_DigestUpdate() failed, _hashlib_HASH_hash() raised a Python
exception, however, _hashlib.HASH.update() and the _hashlib.HASH
constructor release the GIL before calling it when the data is larger
than HASHLIB_GIL_MINSIZE bytes.

_hashlib_HASH_hash() now only returns an error status and its callers
raise the exception once they have re-attached the thread state.
(cherry picked from commit 6fa2d64)

Co-authored-by: Bénédikt Tran 10796600+picnixz@users.noreply.github.com

…aching the thread state (pythonGH-159817)

When `EVP_DigestUpdate()` failed, `_hashlib_HASH_hash()` raised a Python
exception, however, `_hashlib.HASH.update()` and the `_hashlib.HASH`
constructor release the GIL before calling it when the data is larger
than `HASHLIB_GIL_MINSIZE` bytes.

`_hashlib_HASH_hash()` now only returns an error status and its callers
raise the exception once they have re-attached the thread state.
(cherry picked from commit 6fa2d64)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Oct 20, 2026
@picnixz
picnixz merged commit 0405f10 into python:3.15 Oct 20, 2026
62 checks passed
@miss-islington
miss-islington deleted the backport-6fa2d64-3.15 branch October 20, 2026 19:47
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants