]> granicus.if.org Git - python/commitdiff
Add testcase for SF 742911.
authorGuido van Rossum <guido@python.org>
Thu, 29 May 2003 14:26:57 +0000 (14:26 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 29 May 2003 14:26:57 +0000 (14:26 +0000)
Lib/test/test_descr.py

index 972e22401ae8a58863d2116610e9f06ae53f39ee..3a7f81389a16f2ee55791421018a1637e0ac3c3e 100644 (file)
@@ -3871,8 +3871,32 @@ def carloverre():
     else:
         raise TestFailed, "Carlo Verre __delattr__ succeeded!"
 
+def weakref_segfault():
+    # SF 742911
+    if verbose:
+        print "Testing weakref segfault..."
+
+    import weakref
+
+    class Provoker:
+        def __init__(self, referrent):
+            self.ref = weakref.ref(referrent)
+
+        def __del__(self):
+            x = self.ref()
+            print x
+            return x
+
+    class Oops(object):
+        pass
+
+    o = Oops()
+    o.whatever = Provoker(o)
+    del o
+
 
 def test_main():
+    weakref_segfault() # Must be first, somehow
     do_this_first()
     class_docstrings()
     lists()