diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-24 06:46:58 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-24 06:46:58 (GMT) |
commit | 08bba953eacd60a011224ff633189f11291427b4 (patch) | |
tree | 4cd5a2adfdb5538116d0f6efe54d087886e1ef4e /Lib/doctest.py | |
parent | ee30927b45385f0027b7a28e676efbb5bd239769 (diff) | |
download | cpython-08bba953eacd60a011224ff633189f11291427b4.zip cpython-08bba953eacd60a011224ff633189f11291427b4.tar.gz cpython-08bba953eacd60a011224ff633189f11291427b4.tar.bz2 |
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!
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 270e308..08879dd 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -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 |