summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2021-05-17 07:35:16 (GMT)
committerGitHub <noreply@github.com>2021-05-17 07:35:16 (GMT)
commitc10392e7ddb3eafbd11e9ffe335c07648426715f (patch)
tree146c4df27ee1c94b07f90f6683f0843030588849 /Modules
parentb102dd598dd2666b72e93ae53ae813d1e88f186c (diff)
downloadcpython-c10392e7ddb3eafbd11e9ffe335c07648426715f.zip
cpython-c10392e7ddb3eafbd11e9ffe335c07648426715f.tar.gz
cpython-c10392e7ddb3eafbd11e9ffe335c07648426715f.tar.bz2
bpo-44145: Release the GIL around HMAC_Update. (GH-26157)
It was always meant to be released for parallelization. This now matches the other similar code in the module. Thanks michaelforney for noticing!
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_hashopenssl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index e4a2885..b9e68c0 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -1496,9 +1496,11 @@ _hmac_update(HMACobject *self, PyObject *obj)
}
if (self->lock != NULL) {
- ENTER_HASHLIB(self);
+ Py_BEGIN_ALLOW_THREADS
+ PyThread_acquire_lock(self->lock, 1);
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
- LEAVE_HASHLIB(self);
+ PyThread_release_lock(self->lock);
+ Py_END_ALLOW_THREADS
} else {
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
}