mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
doctest doesn't handle intentional SyntaxError exceptions gracefully,
because it picks up the first line of traceback.format_exception_only() instead of the last line. Pick up the last line instead!
This commit is contained in:
parent
ee30927b45
commit
08bba953ea
1 changed files with 1 additions and 1 deletions
|
@ -501,7 +501,7 @@ def _run_examples_inner(out, fakeout, examples, globs, verbose, name):
|
|||
# the traceback isn't necessary.
|
||||
want = want.split('\n')[-2] + '\n'
|
||||
exc_type, exc_val, exc_tb = sys.exc_info()
|
||||
got = traceback.format_exception_only(exc_type, exc_val)[0]
|
||||
got = traceback.format_exception_only(exc_type, exc_val)[-1]
|
||||
state = OK
|
||||
else:
|
||||
# unexpected exception
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue