[Python-checkins] CVS: python/dist/src/Lib doctest.py,1.10,1.11
Tim Peters
tim_one@users.sourceforge.net
Sat, 23 Jun 2001 23:47:01 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv28580/Lib
Modified Files:
doctest.py
Log Message:
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!
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** doctest.py 2001/03/21 23:07:59 1.10
--- doctest.py 2001/06/24 06:46:58 1.11
***************
*** 502,506 ****
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]
state = OK
else:
--- 502,506 ----
want = want.split('\n')[-2] + '\n'
exc_type, exc_val, exc_tb = sys.exc_info()
! got = traceback.format_exception_only(exc_type, exc_val)[-1]
state = OK
else: