#3021: Antoine Pitrou's Lexical exception handlers

This commit is contained in:
Benjamin Peterson 2008-06-11 15:59:43 +00:00
parent e8465f2b41
commit eec3d71379
17 changed files with 410 additions and 303 deletions

View file

@ -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)