summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-20 23:23:34 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-20 23:23:34 (GMT)
commit6e7740c790bf41f520e304ec17abf79a5373b5cc (patch)
treed56ae0f5e5952ce1acae9e97372cd148c10e297b /Lib
parent41e36676cd820ece16b9f8db07be8d541f264116 (diff)
downloadcpython-6e7740c790bf41f520e304ec17abf79a5373b5cc.zip
cpython-6e7740c790bf41f520e304ec17abf79a5373b5cc.tar.gz
cpython-6e7740c790bf41f520e304ec17abf79a5373b5cc.tar.bz2
apply a fix for #3611 where the current exception context was deleted with a generator causing a segfault
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_exceptions.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 5ce76f1..6075b8d 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -564,6 +564,28 @@ class ExceptionTests(unittest.TestCase):
pass
self.assertEquals(e, (None, None, None))
+ def test_3118(self):
+ def gen():
+ try:
+ yield 1
+ finally:
+ pass
+
+ def f():
+ g = gen()
+ next(g)
+ try:
+ try:
+ raise ValueError
+ except:
+ del g
+ raise KeyError
+ except Exception as e:
+ self.assert_(isinstance(e.__context__, ValueError))
+
+ f()
+
+
def test_badisinstance(self):
# Bug #2542: if issubclass(e, MyException) raises an exception,
# it should be ignored