Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d70246

Browse files
committed
Add testcase for SF bug 574207 (chained __slots__ dealloc segfault).
Fix forthcoming.
1 parent 2d3c03d commit 2d70246

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lib/test/test_descr.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,6 +3219,19 @@ def __del__(self):
32193219
# it as a leak.
32203220
del C.__del__
32213221

3222+
def slottrash():
3223+
# Deallocating deeply nested slotted trash caused stack overflows
3224+
if verbose:
3225+
print "Testing slot trash..."
3226+
class trash(object):
3227+
__slots__ = ['x']
3228+
def __init__(self, x):
3229+
self.x = x
3230+
o = None
3231+
for i in xrange(50000):
3232+
o = trash(o)
3233+
del o
3234+
32223235
def do_this_first():
32233236
if verbose:
32243237
print "Testing SF bug 551412 ..."
@@ -3310,6 +3323,7 @@ def test_main():
33103323
copy_setstate()
33113324
slices()
33123325
subtype_resurrection()
3326+
slottrash()
33133327
if verbose: print "All OK"
33143328

33153329
if __name__ == "__main__":

0 commit comments

Comments
 (0)