[issue4751] Patch for better thread support in hashlib

Antoine Pitrou report at bugs.python.org
Fri Dec 26 22:57:17 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Hi,

Very good idea. However, you don't need to discriminate for the bytes
type specifically. When a buffer is taken on the object (with
PyObject_GetBuffer()), the object is internally "locked" until the
buffer is release with PyBuffer_Release(). Try with a bytearray and
you'll see: if you resize the bytearray while hashing it in another
thread, you'll get a BufferError exception.

All in all, it should make your code and macros much simpler.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4751>
_______________________________________


More information about the Python-bugs-list mailing list