#3021: Antoine Pitrou's Lexical exception handlers
diff --git a/Lib/doctest.py b/Lib/doctest.py
index dad8333..74be21e 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1242,10 +1242,9 @@
# 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 @@
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)