Index: Lib/test/test_exceptions.py =================================================================== --- Lib/test/test_exceptions.py (révision 64282) +++ Lib/test/test_exceptions.py (copie de travail) @@ -5,6 +5,8 @@ import unittest import pickle import weakref +import gc +import traceback from test.support import TESTFN, unlink, run_unittest @@ -551,6 +553,23 @@ del g self.assertEquals(sys.exc_info()[0], TypeError) + def test_crash_3114(self): + # Bug #3114: in its destructor, MyObject retrieves a pointer to a + # deallocated exception instance or traceback. + class MyObject: + def __del__(self): + nonlocal e + e = sys.exc_info() + e = () + try: + raise Exception(MyObject()) + except: + pass + gc.collect() + [0]*10000 + # Do something with the exception and its traceback + traceback.format_exception(*e) + def test_main(): run_unittest(ExceptionTests)