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 <rep...@bugs.python.org> <http://bugs.python.org/issue20578> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com