From 189a6c94e4a19e27315ddba5cc57ff0bfca7a717 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 29 May 2003 14:21:29 +0000 Subject: [PATCH] Add testcase for SF 742911. --- Lib/test/test_descr.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index f92bba29c3ed..bf3768153929 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3144,6 +3144,29 @@ def dict_type_with_metaclass(): __metaclass__ = M veris(type(C.__dict__), type(B.__dict__)) +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(): class_docstrings() @@ -3209,6 +3232,7 @@ def test_main(): funnynew() subclass_right_op() dict_type_with_metaclass() + weakref_segfault() if verbose: print "All OK" -- 2.47.3