summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-06-15 00:05:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-06-15 00:05:44 (GMT)
commit979f31172890fcfa45e5e23c461b1517a49dbf3b (patch)
treee395bcce840cfcdb0c5c648aa7f73fa511a4f9e0 /Lib
parentc5e94641bff2557a55be2a497bf974ff9c2a6e28 (diff)
downloadcpython-979f31172890fcfa45e5e23c461b1517a49dbf3b.zip
cpython-979f31172890fcfa45e5e23c461b1517a49dbf3b.tar.gz
cpython-979f31172890fcfa45e5e23c461b1517a49dbf3b.tar.bz2
#3114 fix a bus error when deallocated exceptions were used
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_exceptions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 55a57ba..753e33b 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -5,6 +5,8 @@ import sys
import unittest
import pickle
import weakref
+import gc
+import traceback
from test.support import TESTFN, unlink, run_unittest
@@ -551,6 +553,23 @@ class ExceptionTests(unittest.TestCase):
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)