Message174132
The new patch further improve tests and error message, checking for both numbers and strings:
>>> b = bytearray(b'fooooooo')
>>> b[3:4] = 'foo'
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
>>> b[3:4] = 5
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
>>> b[3:4] = 5.2
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
>>> b[3:4] = None
TypeError: 'NoneType' object is not iterable
Before the patch these errors were reported instead:
>>> b = bytearray(b'fooooooo')
>>> b[3:4] = 'foo' # can't provide encoding here
TypeError: string argument without an encoding
>>> b[3:4] = 5 # this "worked"
>>> b[3:4] = 5.2
TypeError: 'float' object is not iterable
>>> b[3:4] = None
TypeError: 'NoneType' object is not iterable |
|
Date |
User |
Action |
Args |
2012-10-29 17:01:25 | ezio.melotti | set | recipients:
+ ezio.melotti, loewis, georg.brandl, pitrou, abacabadabacaba |
2012-10-29 17:01:25 | ezio.melotti | set | messageid: <1351530085.08.0.724612916873.issue8401@psf.upfronthosting.co.za> |
2012-10-29 17:01:25 | ezio.melotti | link | issue8401 messages |
2012-10-29 17:01:24 | ezio.melotti | create | |
|