mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Implicit exception chaining via __context__ (PEP 3134).
Patch 3108 by Antooine Pitrou.
This commit is contained in:
parent
973124fd70
commit
b4fb6e4d27
4 changed files with 139 additions and 33 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue