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 martin.panter
Recipients alexei.romanov, johan, martin.panter, ned.deily, pitrou, serhiy.storchaka, steve.dower, terry.reedy, tim.golden, wolma, zach.ware
Date 2015-04-20.03:32:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429500728.63.0.70792284009.issue23985@psf.upfronthosting.co.za>
In-reply-to
Content
A test case for this that would trigger when memory debugging is enabled could look something like the following. Would it be appropriate to add it to the test suite?

a = bytearray(10)
size = sys.getsizeof(a)
a.pop()  # Defeat expanding buffer off-by-one quirk
self.assertEqual(sys.getsizeof(a), size, "Quirk not defeated")
del a[:1]
# Or a.pop(0)  # Does not trigger bug
# Or a[:1] = ()  # Triggers bug
self.assertEqual(sys.getsizeof(a), size, "Test assumes buffer not resized")
a += bytes(2)  # Add exactly the number of free bytes in buffer
# Or a.extend(bytes(2))  # Unaffected
# Or a.append(0); a.append(0)  # Unaffected
# Or a[8:] = bytes(2)  # Unaffected
del a  # Trigger memory buffer to be freed, with verification
History
Date User Action Args
2015-04-20 03:32:08martin.pantersetrecipients: + martin.panter, terry.reedy, pitrou, tim.golden, ned.deily, zach.ware, serhiy.storchaka, steve.dower, wolma, alexei.romanov, johan
2015-04-20 03:32:08martin.pantersetmessageid: <1429500728.63.0.70792284009.issue23985@psf.upfronthosting.co.za>
2015-04-20 03:32:08martin.panterlinkissue23985 messages
2015-04-20 03:32:08martin.pantercreate