diff options
author | Guido van Rossum <guido@python.org> | 2008-06-14 20:20:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2008-06-14 20:20:24 (GMT) |
commit | b4fb6e4d27b56c2119bd1dad83afce874e34a72a (patch) | |
tree | 8d3d70b49164329da4a47c9d08364f18018b16df /Lib/test/test_exceptions.py | |
parent | 973124fd70687f6032a1d6e3a0b9e640d2691133 (diff) | |
download | cpython-b4fb6e4d27b56c2119bd1dad83afce874e34a72a.zip cpython-b4fb6e4d27b56c2119bd1dad83afce874e34a72a.tar.gz cpython-b4fb6e4d27b56c2119bd1dad83afce874e34a72a.tar.bz2 |
Implicit exception chaining via __context__ (PEP 3134).
Patch 3108 by Antooine Pitrou.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 9068554..55a57ba 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) |