summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-03-07 17:14:15 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-03-07 17:14:15 (GMT)
commitd01444d325c0e62b846b795e3443e97932271e17 (patch)
tree19ac172e2887aeec92eb8d915601ff8e9f49a796 /Lib/test/test_exceptions.py
parent056c060589a2c90eea2555495b83ba04de850d28 (diff)
downloadcpython-d01444d325c0e62b846b795e3443e97932271e17.zip
cpython-d01444d325c0e62b846b795e3443e97932271e17.tar.gz
cpython-d01444d325c0e62b846b795e3443e97932271e17.tar.bz2
Merged revisions 78766 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r78766 | benjamin.peterson | 2010-03-07 11:10:51 -0600 (Sun, 07 Mar 2010) | 1 line prevent generator finalization from invalidating sys.exc_info() #7173 ........
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 6aa8102..b10835d 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -6,7 +6,8 @@ import unittest
import pickle
import weakref
-from test.support import TESTFN, unlink, run_unittest, captured_output
+from test.support import (TESTFN, unlink, run_unittest, captured_output,
+ gc_collect)
# XXX This is not really enough, each *operation* should be tested!
@@ -554,6 +555,20 @@ class ExceptionTests(unittest.TestCase):
del g
self.assertEquals(sys.exc_info()[0], TypeError)
+ def test_generator_finalizing_and_exc_info(self):
+ # See #7173
+ def simple_gen():
+ yield 1
+ def run_gen():
+ gen = simple_gen()
+ try:
+ raise RuntimeError
+ except RuntimeError:
+ return next(gen)
+ run_gen()
+ gc_collect()
+ self.assertEqual(sys.exc_info(), (None, None, None))
+
def test_3114(self):
# Bug #3114: in its destructor, MyObject retrieves a pointer to
# obsolete and/or deallocated objects.