mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
#3021: Antoine Pitrou's Lexical exception handlers
This commit is contained in:
parent
e8465f2b41
commit
eec3d71379
17 changed files with 410 additions and 303 deletions
|
@ -1242,10 +1242,9 @@ class DocTestRunner:
|
|||
|
||||
# The example raised an exception: check if it was expected.
|
||||
else:
|
||||
exc_info = sys.exc_info()
|
||||
exc_msg = traceback.format_exception_only(*exc_info[:2])[-1]
|
||||
exc_msg = traceback.format_exception_only(*exception[:2])[-1]
|
||||
if not quiet:
|
||||
got += _exception_traceback(exc_info)
|
||||
got += _exception_traceback(exception)
|
||||
|
||||
# If `example.exc_msg` is None, then we weren't expecting
|
||||
# an exception.
|
||||
|
@ -1275,7 +1274,7 @@ class DocTestRunner:
|
|||
elif outcome is BOOM:
|
||||
if not quiet:
|
||||
self.report_unexpected_exception(out, test, example,
|
||||
exc_info)
|
||||
exception)
|
||||
failures += 1
|
||||
else:
|
||||
assert False, ("unknown outcome", outcome)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue