Repository navigation
Commit de4951c
committed
gh-159811: Raise OpenSSL errors in
`hashlib_openssl_HMAC_update_once()` set an exception when the OpenSSL
HMAC update function failed, but it is called inside a GIL-released
region, with the object's mutex held, by `_hashlib.HMAC.update()` and
`_hashlib.hmac_new()` when the data exceeds HASHLIB_GIL_MINSIZE bytes.
Setting the exception with the thread state detached crashed the
interpreter instead of raising an exception.
Only report the failure in `hashlib_openssl_HMAC_update_once()` and set
the exception in `_hmac_update()` once the thread state is re-attached
and the mutex is released, as it was done before gh-134531. The OpenSSL
error queue is per thread, so the exception type and message are
unaffected._hashlib.HMAC after re-attaching the thread state1 parent 395d766 commit de4951c
2 files changed
Lines changed: 17 additions & 6 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 | |
|---|---|---|---|
| |||
1976 | 1976 | | |
1977 | 1977 | | |
1978 | 1978 | | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
1979 | 1985 | | |
1980 | 1986 | | |
1981 | 1987 | | |
1982 | | - | |
1983 | | - | |
1984 | | - | |
1985 | | - | |
1986 | | - | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1987 | 1991 | | |
1988 | 1992 | | |
1989 | 1993 | | |
| |||
2243 | 2247 | | |
2244 | 2248 | | |
2245 | 2249 | | |
2246 | | - | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
2247 | 2255 | | |
2248 | 2256 | | |
2249 | 2257 | | |
| |||
0 commit comments