Message220062
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 |
|
| Date |
User |
Action |
Args |
| 2014-06-08 22:17:01 | nikratio | set | recipients:
+ nikratio, loewis, pitrou, vstinner, benjamin.peterson, stutzbach, python-dev, hynek |
| 2014-06-08 22:17:01 | nikratio | set | messageid: <[email protected]> |
| 2014-06-08 22:17:01 | nikratio | link | issue20578 messages |
| 2014-06-08 22:17:01 | nikratio | create | |
|