Skip to content

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

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

picnixz merged 1 commit into
python:3.14from
picnixz:backport-6fa2d64-3.14

Conversation

@picnixz

@picnixz picnixz commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

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)

… re-attaching 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>
@picnixz
picnixz requested a review from gpshead as a code owner October 20, 2026 18:09
@bedevere-app bedevere-app Bot added the sprint label Oct 20, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 20, 2026
@picnixz
picnixz merged commit 5eed22f into python:3.14 Oct 20, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 20, 2026
@picnixz
picnixz deleted the backport-6fa2d64-3.14 branch October 20, 2026 19:46
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.

1 participant