summaryrefslogtreecommitdiff
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 906855403e..55a57baee1 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -480,7 +480,12 @@ class ExceptionTests(unittest.TestCase):
inner_raising_func()
except:
raise KeyError
- except KeyError:
+ except KeyError as e:
+ # We want to test that the except block above got rid of
+ # the exception raised in inner_raising_func(), but it
+ # also ends up in the __context__ of the KeyError, so we
+ # must clear the latter manually for our test to succeed.
+ e.__context__ = None
obj = None
obj = wr()
self.failUnless(obj is None, "%s" % obj)