Message 78308 - Python tracker
I think that you don't use Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS correctly: the GIL can be released when the hashlib lock is acquired (to run hash functions in parallel threads). So the macros should be: #define ENTER_HASHLIB \ PyThread_acquire_lock(self->lock, 1); \ Py_BEGIN_ALLOW_THREADS #define LEAVE_HASHLIB \ Py_END_ALLOW_THREADS \ PyThread_release_lock(self->lock); If I'm right, issue #4738 (zlib) is also affected.