This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients abacabadabacaba, ezio.melotti, georg.brandl, loewis, pitrou
Date 2012-10-29.17:01:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351530085.08.0.724612916873.issue8401@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012-10-29 17:01:25ezio.melottisetrecipients: + ezio.melotti, loewis, georg.brandl, pitrou, abacabadabacaba
2012-10-29 17:01:25ezio.melottisetmessageid: <1351530085.08.0.724612916873.issue8401@psf.upfronthosting.co.za>
2012-10-29 17:01:25ezio.melottilinkissue8401 messages
2012-10-29 17:01:24ezio.melotticreate