Issue1443

classification
Title: Can't update() hashlib.sha1() with array.array('c')
Type: behaviour Severity: major
Components: Library Versions: 2.5.0
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, pjdm, pjenvey
Priority: Keywords:

Created on 2009-08-19.12:23:15 by pjdm, last changed 2009-09-09.04:17:03 by pjenvey.

Messages
msg5059 (view) Author: Peter Mayne (pjdm) Date: 2009-08-19.12:23:14
This program updates an sha1 hash with an array.array('c').

import hashlib
import array

a=array.array('c', 'hovercraft')
s=hashlib.sha1()
s.update(a)
print s.hexdigest()

This works using CPython 2.5.4. Jython 2.5.0 results in

Traceback (most recent call last):
  File "supdate.py", line 6, in <module>
    s.update(a)
TypeError: update() argument 1 must be string or read-only buffer, not
array.array

The result in  this case should be as if update() was called with
a.tostring(). Other array.array types also seem to work using CPython.

(Note that the error message is arguably incorrect. It's identical to
the Python error message, but Jython does not have read-only buffers.)
msg5122 (view) Author: Philip Jenvey (pjenvey) Date: 2009-09-09.04:17:03
fixed in r6771
History
Date User Action Args
2009-09-09 04:17:03pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg5122
nosy: + pjenvey
2009-08-21 19:10:08fwierzbickisetnosy: + fwierzbicki
2009-08-19 12:23:15pjdmcreate