[issue20578] BufferedIOBase.readinto1 is missing

Nikolaus Rath report at bugs.python.org
Mon Jun 9 00:17:01 CEST 2014


Nikolaus Rath added the comment:

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

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20578>
_______________________________________


More information about the Python-bugs-list mailing list