]> granicus.if.org Git - python/commitdiff
Add testcase for SF bug 574207 (chained __slots__ dealloc segfault).
authorGuido van Rossum <guido@python.org>
Tue, 6 Aug 2002 21:28:28 +0000 (21:28 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 6 Aug 2002 21:28:28 +0000 (21:28 +0000)
Fix forthcoming.

Lib/test/test_descr.py

index 543dfa475fa1b0914847297b016a9e953ea4ede8..94dba1a3796aec3bc8afc81ddde91c88af3f6e4d 100644 (file)
@@ -3219,6 +3219,19 @@ def subtype_resurrection():
     # it as a leak.
     del C.__del__
 
+def slottrash():
+    # Deallocating deeply nested slotted trash caused stack overflows
+    if verbose:
+        print "Testing slot trash..."
+    class trash(object):
+        __slots__ = ['x']
+        def __init__(self, x):
+            self.x = x
+    o = None
+    for i in xrange(50000):
+        o = trash(o)
+    del o
+
 def do_this_first():
     if verbose:
         print "Testing SF bug 551412 ..."
@@ -3310,6 +3323,7 @@ def test_main():
     copy_setstate()
     slices()
     subtype_resurrection()
+    slottrash()
     if verbose: print "All OK"
 
 if __name__ == "__main__":