This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tjollans
Recipients tjollans
Date 2010-06-13.19:42:51
SpamBayes Score 0.00015211302
Marked as misclassified No
Message-id <1276458174.59.0.784735349158.issue8990@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, the array constructor, if given a bytearray, detects this with PyByteArray_Check, and hands it on to array_fromstring, which does not support bytearray (by using "s#" with PyArg_ParseTuple) and raises TypeError.

>>> array('h', bytearray(b'xyxyxyxyxyxyxyxyxy'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be bytes or read-only buffer, not bytearray
>>>  


I see no reason to insist on read-only buffers. I'm attaching a patch that I think fixes this.
History
Date User Action Args
2010-06-13 19:42:55tjollanssetrecipients: + tjollans
2010-06-13 19:42:54tjollanssetmessageid: <1276458174.59.0.784735349158.issue8990@psf.upfronthosting.co.za>
2010-06-13 19:42:52tjollanslinkissue8990 messages
2010-06-13 19:42:52tjollanscreate