[Python-checkins] CVS: python/dist/src/Lib traceback.py,1.25,1.25.2.1

Thomas Wouters twouters@users.sourceforge.net
Wed, 27 Jun 2001 07:07:52 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv32502/Lib

Modified Files:
      Tag: release21-maint
	traceback.py 
Log Message:

Backport Tim's checkin 1.26 (patch probably by Michael Hudson, not Hundson):

SF bug 431772:  traceback.print_exc() causes traceback
Patch from Michael Hundson. 
format_exception_only() blew up when trying to report a SyntaxError
from a string input (line is None in this case, but it assumed a string). 



Index: traceback.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -C2 -r1.25 -r1.25.2.1
*** traceback.py	2001/03/29 04:36:08	1.25
--- traceback.py	2001/06/27 14:07:50	1.25.2.1
***************
*** 172,188 ****
                  list.append('  File "%s", line %d\n' %
                              (filename, lineno))
!                 i = 0
!                 while i < len(line) and line[i].isspace():
!                     i = i+1
!                 list.append('    %s\n' % line.strip())
!                 if offset is not None:
!                     s = '    '
!                     for c in line[i:offset-1]:
!                         if c.isspace():
!                             s = s + c
!                         else:
!                             s = s + ' '
!                     list.append('%s^\n' % s)
!                 value = msg
          s = _some_str(value)
          if s:
--- 172,189 ----
                  list.append('  File "%s", line %d\n' %
                              (filename, lineno))
!                 if line is not None:
!                     i = 0
!                     while i < len(line) and line[i].isspace():
!                         i = i+1
!                     list.append('    %s\n' % line.strip())
!                     if offset is not None:
!                         s = '    '
!                         for c in line[i:offset-1]:
!                             if c.isspace():
!                                 s = s + c
!                             else:
!                                 s = s + ' '
!                         list.append('%s^\n' % s)
!                     value = msg
          s = _some_str(value)
          if s: