Message5059
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.) |
|
Date |
User |
Action |
Args |
2009-08-19 12:23:15 | pjdm | set | recipients:
+ pjdm |
2009-08-19 12:23:15 | pjdm | set | messageid: <1250684595.11.0.446010437617.issue1443@psf.upfronthosting.co.za> |
2009-08-19 12:23:15 | pjdm | link | issue1443 messages |
2009-08-19 12:23:14 | pjdm | create | |
|