summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2012-12-27 21:38:04 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2012-12-27 21:38:04 +0200
commit07e0e06f8a255a73d181e332dd8658814eb1ca50 (patch)
tree1b611b45e24e3134804ac72adc103c8258746e84
parentc8bd74ddfd5a41e8f37181bf4ba3c9e37b6d65b1 (diff)
downloadcpython-git-07e0e06f8a255a73d181e332dd8658814eb1ca50.tar.gz
Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.
Patch by Roger Serwy.
-rw-r--r--Lib/idlelib/EditorWindow.py2
-rw-r--r--Misc/NEWS3
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 48aabc8f69..16f63c52a4 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1618,7 +1618,7 @@ class IndentSearcher(object):
tokens = _tokenize.generate_tokens(self.readline)
for token in tokens:
self.tokeneater(*token)
- except _tokenize.TokenError:
+ except (_tokenize.TokenError, SyntaxError):
# since we cut off the tokenizer early, we can trigger
# spurious errors
pass
diff --git a/Misc/NEWS b/Misc/NEWS
index 08d3e36c81..d13a40646a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -182,6 +182,9 @@ Core and Builtins
Library
-------
+- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by
+ Roger Serwy.
+
- Issue #16618: Make glob.glob match consistently across strings and bytes
regarding leading dots. Patch by Serhiy Storchaka.