Repository navigation
Commit 060abbf
committed
gh-159811: Raise OpenSSL errors in
`hashlib_openssl_HMAC_update_once()` set an exception when the OpenSSL
HMAC update function failed, but it was 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.
Remove that helper, call the OpenSSL HMAC update function directly in
`_hmac_update()`, and set the exception 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 060abbf
2 files changed
Lines changed: 10 additions & 12 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 | | - | |
1985 | | - | |
1986 | | - | |
1987 | | - | |
1988 | | - | |
1989 | 1979 | | |
1990 | 1980 | | |
1991 | 1981 | | |
| |||
2240 | 2230 | | |
2241 | 2231 | | |
2242 | 2232 | | |
2243 | | - | |
| 2233 | + | |
| 2234 | + | |
2244 | 2235 | | |
2245 | 2236 | | |
2246 | | - | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
2247 | 2242 | | |
2248 | 2243 | | |
2249 | 2244 | | |
| |||
0 commit comments