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 gumpy
Recipients gumpy, pitrou
Date 2008-12-06.02:10:22
SpamBayes Score 4.762752e-08
Marked as misclassified No
Message-id <1228529424.11.0.233407832971.issue4509@psf.upfronthosting.co.za>
In-reply-to
Content
I found another related bug. In bytes_setslice, when the buffer is
resized to a smaller size, a memmove happens regardless of whether the
resize is successful or not.

>>> b = bytearray(range(10))
>>> m = memoryview(b)
>>> b[1:8] = b'X'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BufferError: Existing exports of data: object cannot be re-sized
>>> b
bytearray(b'\x00\x01\x08\t\x04\x05\x06\x07\x08\t')

The same problem also applies to bytes_remove:

>>> b
bytearray(b'\x02\x03\x04\x05\x06\x07\x08\t')
>>> b.remove(2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BufferError: Existing exports of data: object cannot be re-sized
>>> b
bytearray(b'\x03\x04\x05\x06\x07\x08\t\x00')

There may be other places this can happen but I haven't checked yet.
History
Date User Action Args
2008-12-06 02:10:24gumpysetrecipients: + gumpy, pitrou
2008-12-06 02:10:24gumpysetmessageid: <1228529424.11.0.233407832971.issue4509@psf.upfronthosting.co.za>
2008-12-06 02:10:23gumpylinkissue4509 messages
2008-12-06 02:10:22gumpycreate