[issue6071] no longer possible to hash arrays

2010-01-04 Thread Benjamin Peterson
Benjamin Peterson added the comment: Done in r77313. -- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed ___ Python tracker ___ _

[issue6071] no longer possible to hash arrays

2010-01-04 Thread Ezio Melotti
Ezio Melotti 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

[issue6071] no longer possible to hash arrays

2010-01-03 Thread ivank
ivank added the comment: I believe this was fixed in r77252, which was fixing http://bugs.python.org/issue3745 -- ___ Python tracker ___

[issue6071] no longer possible to hash arrays

2009-12-07 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: Will this be fixed for Python 2.7 final? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue6071] no longer possible to hash arrays

2009-11-23 Thread Antoine Pitrou
Antoine Pitrou 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

[issue6071] no longer possible to hash arrays

2009-11-23 Thread Martin v . Löwis
Martin v. Löwis 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 thi

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I would prefer if I opened a separate issue for this bug. if /you/ opened, of course... -- ___ Python tracker ___ ___

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I fixed the array_ass_slice for python 2.7 in the attached patch. I would prefer if I opened a separate issue for this bug. That way it will be easier to port the patch separately to py3k. -- ___ Python tracker <

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Jan Hosang
Jan Hosang added the comment: I fixed the array_ass_slice for python 2.7 in the attached patch. The problem should apply to python 3k as well: firstly the above which might stay unnoticed and secondly the function moves to much memory if the array size is increased: (Py_SIZE(a)-d-ihigh) items

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Jan Hosang
Jan Hosang added the comment: I was looking at the remaining differences between Modules/arraymodule.c in python 2.7 and the 3k branch, in particular I was testing why including the changes to the function array_ass_slice into the patch breaks the unit test of the array module. The manual re

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Barry A. Warsaw
Barry A. Warsaw 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 __

[issue6071] no longer possible to hash arrays

2009-09-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: After thinking about it, we should remover the bf_releasebuffer checks when using the old typecodes '#' (the doc should also clearly state that these are unsafe and '*' is preferred). If a type chooses to implement the /old/ buffer API and if a method requires

[issue6071] no longer possible to hash arrays

2009-09-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The first thing the function does is checking if the object implements > the old buffer api, but also fails if pb->bf_releasebuffer != NULL. So I > guess it's also making sure the new buffer api is not implemented. > > What's the thought behind this? The i

[issue6071] no longer possible to hash arrays

2009-09-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The patch breaks five unit tests from other modules, I'll look into it. What are those tests? -- ___ Python tracker ___ _

[issue6071] no longer possible to hash arrays

2009-09-26 Thread Jan Hosang
Jan Hosang added the comment: I stumbled upon the following function: static Py_ssize_t convertbuffer(PyObject *arg, void **p, char **errmsg) in Python/getargs.c The first thing the function does is checking if the object implements the old buffer api, but also fails if pb->bf_releasebuffer !

[issue6071] no longer possible to hash arrays

2009-09-26 Thread Jan Hosang
Jan Hosang added the comment: You asked "what" not "which" :) test test_codecs failed -- Traceback (most recent call last): File "/Users/jan/src/python-svn/Lib/test/test_codecs.py", line 531, in test_array codecs.readbuffer_encode(array.array("c", "spam")), TypeError: must be string or r

[issue6071] no longer possible to hash arrays

2009-09-26 Thread Jan Hosang
Jan Hosang added the comment: > > The patch breaks five unit tests from other modules, I'll look into > > it. > > What are those tests? test_codecs, test_ioctl, test_multiprocessing, test_socket and test_struct. -- ___ Python tracker

[issue6071] no longer possible to hash arrays

2009-09-25 Thread Jan Hosang
Jan Hosang added the comment: The patch breaks five unit tests from other modules, I'll look into it. -- ___ Python tracker ___ ___ Py

[issue6071] no longer possible to hash arrays

2009-09-25 Thread Jan Hosang
Jan Hosang added the comment: I added the two functions for the new buffer API. Having an exported memory view needs some handling elsewhere, so the array does not change. I also added tests for checking that behaviour. Mainly I copypasted code from py3k which involved redirecting to array_r

[issue6071] no longer possible to hash arrays

2009-09-25 Thread Antoine Pitrou
Antoine Pitrou 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: You should take a look at the array module in py3k, it supports the new buffer API. With a bit of luck, the t

[issue6071] no longer possible to hash arrays

2009-09-21 Thread Jan Hosang
Jan Hosang 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'

[issue6071] no longer possible to hash arrays

2009-09-08 Thread Georg Brandl
Georg Brandl added the comment: Can't hurt :) -- nosy: +georg.brandl priority: high -> release blocker ___ Python tracker ___ ___ Pyth

[issue6071] no longer possible to hash arrays

2009-09-08 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: Can this ticket be marked as a release blocker so it's not forgotten about for 2.7? -- ___ Python tracker ___ _

[issue6071] no longer possible to hash arrays

2009-07-13 Thread Martin v . Löwis
Martin v. Löwis 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

[issue6071] no longer possible to hash arrays

2009-07-13 Thread ivank
ivank added the comment: It no longer works with objects created with buffer() either: >>> hashlib.sha1(buffer("x")).hexdigest() Traceback (most recent call last): File "", line 1, in TypeError: object supporting the buffer API required -- ___ Py

[issue6071] no longer possible to hash arrays

2009-05-26 Thread Martin v. Löwis
Martin v. Löwis added the comment: exarkun: would you like to propose a patch? -- nosy: +loewis ___ Python tracker ___ ___ Python-bugs

[issue6071] no longer possible to hash arrays

2009-05-22 Thread Gregory P. Smith
Gregory P. Smith 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 ___ Pyt

[issue6071] no longer possible to hash arrays

2009-05-22 Thread Jean-Paul Calderone
Jean-Paul Calderone 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

[issue6071] no longer possible to hash arrays

2009-05-22 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: I would certainly like to, but unfortunately at present I am unable to. -- ___ Python tracker ___ _

[issue6071] no longer possible to hash arrays

2009-05-20 Thread Antoine Pitrou
Antoine Pitrou 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

[issue6071] no longer possible to hash arrays

2009-05-20 Thread ivank
Changes by ivank : -- nosy: +ivank ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailma

[issue6071] no longer possible to hash arrays

2009-05-20 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone : 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) 7037807198c