Message5059

Author pjdm
Recipients pjdm
Date 2009-08-19.12:23:14
SpamBayes Score 2.5717928e-11
Marked as misclassified No
Message-id <1250684595.11.0.446010437617.issue1443@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2009-08-19 12:23:15pjdmsetrecipients: + pjdm
2009-08-19 12:23:15pjdmsetmessageid: <1250684595.11.0.446010437617.issue1443@psf.upfronthosting.co.za>
2009-08-19 12:23:15pjdmlinkissue1443 messages
2009-08-19 12:23:14pjdmcreate