Message241594
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 |
|
Date |
User |
Action |
Args |
2015-04-20 03:32:08 | martin.panter | set | recipients:
+ martin.panter, terry.reedy, pitrou, tim.golden, ned.deily, zach.ware, serhiy.storchaka, steve.dower, wolma, alexei.romanov, johan |
2015-04-20 03:32:08 | martin.panter | set | messageid: <1429500728.63.0.70792284009.issue23985@psf.upfronthosting.co.za> |
2015-04-20 03:32:08 | martin.panter | link | issue23985 messages |
2015-04-20 03:32:08 | martin.panter | create | |
|