Repository navigation
Commit 5624624
committed
gh-159811: Raise OpenSSL errors in
`_hashlib_HASH_hash()` set an exception when EVP_DigestUpdate() failed,
but it is called inside a GIL-released region by `_hashlib.HASH.update()`
and by the `_hashlib.HASH` constructor when the data exceeds
HASHLIB_GIL_MINSIZE bytes. Setting the exception with the thread state
detached crashed the interpreter instead of raising a ValueError.
Only report the failure in `_hashlib_HASH_hash()` and set the exception
in its callers once the thread state is re-attached. The OpenSSL error
queue is per thread, so the exception message is unaffected._hashlib.HASH after re-attaching the thread state1 parent 395d766 commit 5624624
2 files changed
Lines changed: 15 additions & 3 deletions
File tree
- Misc/NEWS.d/next/Library
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
850 | 856 | | |
851 | 857 | | |
852 | 858 | | |
| |||
858 | 864 | | |
859 | 865 | | |
860 | 866 | | |
861 | | - | |
862 | 867 | | |
863 | 868 | | |
864 | 869 | | |
| |||
991 | 996 | | |
992 | 997 | | |
993 | 998 | | |
994 | | - | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
995 | 1004 | | |
996 | 1005 | | |
997 | 1006 | | |
| |||
1305 | 1314 | | |
1306 | 1315 | | |
1307 | 1316 | | |
1308 | | - | |
| 1317 | + | |
1309 | 1318 | | |
1310 | 1319 | | |
1311 | 1320 | | |
| |||
0 commit comments