diff options
author | Guido van Rossum <guido@python.org> | 2008-01-24 17:58:05 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2008-01-24 17:58:05 (GMT) |
commit | 37edeab77875ef35ea54b92d5ba8a94df7deb3f7 (patch) | |
tree | 04730c76af49de3afc7da67fe4b7670aa8e745d6 /Lib/test/test_descr.py | |
parent | 4e3f12486fe0e4d6caf3c46e501a15283cf1c95e (diff) | |
download | cpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.zip cpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.tar.gz cpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.tar.bz2 |
Fix test67.py from issue #1303614.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 08dfcdf..61be8a8 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4504,6 +4504,29 @@ def test_borrowed_ref_4_segfault(): finally: __builtin__.__import__ = orig_import +def test_losing_dict_ref_segfault(): + # This used to segfault; + # derived from issue #1303614, test67.py + if verbose: + print "Testing losing dict ref segfault..." + + class Strange(object): + def __hash__(self): + return hash('hello') + + def __eq__(self, other): + x.__dict__ = {} # the old x.__dict__ is deallocated + return False + + class X(object): + pass + + v = 123 + x = X() + x.__dict__ = {Strange(): 42, 'hello': v+456} + x.hello + + def test_main(): weakref_segfault() # Must be first, somehow wrapper_segfault() @@ -4606,6 +4629,7 @@ def test_main(): test_weakref_in_del_segfault() test_borrowed_ref_3_segfault() test_borrowed_ref_4_segfault() + test_losing_dict_ref_segfault() if verbose: print "All OK" |