summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-07-03 21:27:41 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-07-03 21:27:41 (GMT)
commit536feac7f863c64f32c3bba492b79ddf03323373 (patch)
tree70170db073a0f0de4b91fe91ac26cfa63ef8c682 /Lib/test/test_exceptions.py
parentffada78059d914619a997d57804c3fd2696a6e37 (diff)
parentac91341333d27bf39dd8b8c1c3164b5bdc19f03b (diff)
downloadcpython-536feac7f863c64f32c3bba492b79ddf03323373.zip
cpython-536feac7f863c64f32c3bba492b79ddf03323373.tar.gz
cpython-536feac7f863c64f32c3bba492b79ddf03323373.tar.bz2
merge 3.2
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 03685b6..f05d3c0 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -582,6 +582,18 @@ class ExceptionTests(unittest.TestCase):
pass
self.assertEqual(sys.exc_info(), (None, None, None))
+ def test_generator_doesnt_retain_old_exc(self):
+ def g():
+ self.assertIsInstance(sys.exc_info()[1], RuntimeError)
+ yield
+ self.assertEqual(sys.exc_info(), (None, None, None))
+ it = g()
+ try:
+ raise RuntimeError
+ except RuntimeError:
+ next(it)
+ self.assertRaises(StopIteration, next, it)
+
def test_generator_finalizing_and_exc_info(self):
# See #7173
def simple_gen():