[issue6071] no longer possible to hash arrays
Ezio Melotti ezio.melo...@gmail.com added the comment: Even if it's fixed a patch with tests should be submitted before closing this issue. -- nosy: +ezio.melotti priority: deferred blocker - normal stage: needs patch - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Benjamin Peterson benja...@python.org added the comment: Done in r77313. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
ivank i...@ludios.org added the comment: I believe this was fixed in r77252, which was fixing http://bugs.python.org/issue3745 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Jean-Paul Calderone exar...@divmod.com added the comment: Will this be fixed for Python 2.7 final? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Martin v. Löwis mar...@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 rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Antoine Pitrou pit...@free.fr added the comment: 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. I know, but the problem is that by switching some argument definitions to s* and friends we have broken compatibility for the (admittedly uncommon) use case of giving an array object to those functions. Since we probably don't want to backout those changes perhaps adding support for the new buffer API to the array object is the best course of action. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Barry A. Warsaw ba...@python.org added the comment: Moving to deferred blocker to get this out of the way for 2.6.3 -- nosy: +barry priority: release blocker - deferred blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Jan Hosang jan.hos...@gmail.com added the comment: I tried to implement the new buffer API, but as soon as I add bf_getbuffer/bf_releasebuffer to PyBufferProcs writing an array to a file breaks: f.write(a) TypeError: must be contiguous buffer, not array.array I searched through the file functions, but couldn't find the point where this happens. Has anybody a suggestion? Does file.write() use the old buffers? Doesn't it use reprfunc? -- nosy: +chuck ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Jean-Paul Calderone exar...@divmod.com added the comment: Can this ticket be marked as a release blocker so it's not forgotten about for 2.7? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Georg Brandl ge...@python.org added the comment: Can't hurt :) -- nosy: +georg.brandl priority: high - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
ivank i...@ludios.org added the comment: It no longer works with objects created with buffer() either: hashlib.sha1(buffer(x)).hexdigest() Traceback (most recent call last): File stdin, line 1, in module TypeError: object supporting the buffer API required -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Martin v. Löwis mar...@v.loewis.de added the comment: It no longer works with objects created with buffer() either: That's because the buffer objects don't implement the buffer protocol (in particular, they don't define the Py_TPFLAGS_HAVE_NEWBUFFER flag, and the bf_getbuffer/bf_releasebuffer operations that go with that flag. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Martin v. Löwis mar...@v.loewis.de added the comment: exarkun: would you like to propose a patch? -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Jean-Paul Calderone exar...@divmod.com added the comment: I would certainly like to, but unfortunately at present I am unable to. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Jean-Paul Calderone exar...@divmod.com added the comment: Perhaps Gregory has some idea about how this can most easily be resolved, since I think he did the work on #3745 which introduced this change in behavior. -- nosy: +gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Gregory P. Smith g...@krypto.org added the comment: to confirm, this is only a problem in 2.7 trunk right? if so, i won't rush a fix. but yes fallback code for legacy types or adding buffer api support to array would work. -- assignee: - gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Changes by ivank i...@ludios.org: -- nosy: +ivank ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
Antoine Pitrou pit...@free.fr added the comment: That's probably because hashlib switched to using the new buffer API, and array.array() only supports the old one in 2.x. Perhaps hashlib should have some fallback code for such legacy types... -- nosy: +pitrou priority: - high stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6071] no longer possible to hash arrays
New submission from Jean-Paul Calderone exar...@divmod.com: It used to be possible to use hashlib with arrays; it no longer seems possible. exar...@charm:~$ python -c ' import sys, hashlib, array print sys.version_info print hashlib.sha1(array.array(b, [1, 2, 3])).hexdigest() ' (2, 5, 2, 'final', 0) 7037807198c22a7d2b0807371d763779a84fdfcf exar...@charm:~$ ~/Projects/python/trunk/python -c ' import sys, hashlib, array print sys.version_info print hashlib.sha1(array.array(b, [1, 2, 3])).hexdigest() ' sys.version_info(major=2, minor=7, micro=0, releaselevel='alpha', serial=0) Traceback (most recent call last): File string, line 4, in module TypeError: object supporting the buffer API required exar...@charm:~$ -- components: Library (Lib) messages: 88122 nosy: exarkun severity: normal status: open title: no longer possible to hash arrays type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com