summaryrefslogtreecommitdiff
path: root/Lib/code.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-03-25 21:44:07 +0000
committerSkip Montanaro <skip@pobox.com>2002-03-25 21:44:07 +0000
commitda2fdfbc3f63e9317342a940cb950b6f771dfa10 (patch)
tree479d3aa1968734c164b3b7e58324a0d37dcdf86c /Lib/code.py
parent6c4c0ef91581a41941a1a224f0a635b9959d4493 (diff)
downloadcpython-da2fdfbc3f63e9317342a940cb950b6f771dfa10.tar.gz
remove unqualified excepts - catch ImportError when trying to import
readline and get rid of string exception fallback when showing syntax errors. see bug 411881
Diffstat (limited to 'Lib/code.py')
-rw-r--r--Lib/code.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/code.py b/Lib/code.py
index ad42a9b1e6..64b7bc086b 100644
--- a/Lib/code.py
+++ b/Lib/code.py
@@ -133,12 +133,7 @@ class InteractiveInterpreter:
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 @@ def interact(banner=None, readfunc=None, local=None):
else:
try:
import readline
- except:
+ except ImportError:
pass
console.interact(banner)