From: Guido van Rossum Date: Thu, 29 May 2003 14:21:29 +0000 (+0000) Subject: Add testcase for SF 742911. X-Git-Tag: v2.2.3~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=189a6c94e4a19e27315ddba5cc57ff0bfca7a717;p=thirdparty%2FPython%2Fcpython.git Add testcase for SF 742911. --- 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"