[issue6071] no longer possible to hash arrays

Martin v. Löwis report at bugs.python.org
Mon Nov 23 09:37:09 CET 2009


Martin v. Löwis <martin at v.loewis.de> added the comment:

I think the error is really in _hashlib, not in the array object. It
should not require 3.x style buffers, but continue to support 2.x
readbuffers. Attached is a patch that takes this route to fixing the bug.

As for the checks for bf_releasebuffer: I still think they are
necessary. If an object implements bf_releasebuffer, that means that the
object may change the buffer underneath, unless proper locking and
unlocking takes place. Indeed, the array's getreadbuf operation is not
thread-safe. It might be possible to remove them if it is clarified that
anybody calling getreadbuffer must not release the GIL while they hold
on to the buffer.

----------
Added file: http://bugs.python.org/file15382/hashlib.diff

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


More information about the Python-bugs-list mailing list