diff Lib/code.py @ 22565:906ad36cb7bc legacy-trunk

remove unqualified excepts - catch ImportError when trying to import readline and get rid of string exception fallback when showing syntax errors. see bug 411881
author Skip Montanaro <skip@pobox.com>
date Mon, 25 Mar 2002 21:44:07 +0000
parents 03f3ab0c7286
children 39e42d6f5da2
line wrap: on
line diff
--- a/Lib/code.py	Mon Mar 25 21:40:36 2002 +0000
+++ b/Lib/code.py	Mon Mar 25 21:44:07 2002 +0000
@@ -133,12 +133,7 @@
                 pass
             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)
+                value = SyntaxError(msg, (filename, lineno, offset, line))
                 sys.last_value = value
         list = traceback.format_exception_only(type, value)
         map(self.write, list)
@@ -302,7 +297,7 @@
     else:
         try:
             import readline
-        except:
+        except ImportError:
             pass
     console.interact(banner)