Author nikratio
Recipients benjamin.peterson, hynek, loewis, nikratio, pitrou, python-dev, stutzbach, vstinner
Date 2014-06-08.22:17:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402265821.17.0.213745299332.issue20578@psf.upfronthosting.co.za>
In-reply-to
Content
I used the wrong interpreter when cutting and pasting the example above, here's the correct version to avoid confusion with the traceback:

>>> import _pyio
>>> from array import array
>>> buf = array('b', b'x' * 10)
>>> _pyio.open('/dev/zero', 'rb').readinto(buf) 
10
>>> buf = array('B', b'x' * 10)
>>> _pyio.open('/dev/zero', 'rb').readinto(buf)
Traceback (most recent call last):
  File "/home/nikratio/clones/cpython/Lib/_pyio.py", line 662, in readinto
    b[:n] = data
TypeError: can only assign array (not "bytes") to array slice

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nikratio/clones/cpython/Lib/_pyio.py", line 667, in readinto
    b[:n] = array.array('b', data)
TypeError: bad argument type for built-in operation
History
Date User Action Args
2014-06-08 22:17:01nikratiosetrecipients: + nikratio, loewis, pitrou, vstinner, benjamin.peterson, stutzbach, python-dev, hynek
2014-06-08 22:17:01nikratiosetmessageid: <1402265821.17.0.213745299332.issue20578@psf.upfronthosting.co.za>
2014-06-08 22:17:01nikratiolinkissue20578 messages
2014-06-08 22:17:01nikratiocreate