Mailing List Archive

CVS: python/dist/src/Lib code.py,1.18,1.19
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11859

Modified Files:
code.py
Log Message:
remove unqualified excepts - catch ImportError when trying to import
readline and get rid of string exception fallback when showing syntax
errors.
see bug 411881


Index: code.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/code.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** code.py 18 Sep 2001 13:33:01 -0000 1.18
--- code.py 25 Mar 2002 21:44:07 -0000 1.19
***************
*** 134,143 ****
else:
# Stuff in the right filename
! try:
! # Assume SyntaxError is a class exception
! value = SyntaxError(msg, (filename, lineno, offset, line))
! except:
! # If that failed, assume SyntaxError is a string
! value = msg, (filename, lineno, offset, line)
sys.last_value = value
list = traceback.format_exception_only(type, value)
--- 134,138 ----
else:
# Stuff in the right filename
! value = SyntaxError(msg, (filename, lineno, offset, line))
sys.last_value = value
list = traceback.format_exception_only(type, value)
***************
*** 303,307 ****
try:
import readline
! except:
pass
console.interact(banner)
--- 298,302 ----
try:
import readline
! except ImportError:
pass
console.interact(banner)