summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2012-12-27 19:53:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2012-12-27 19:53:06 (GMT)
commit64df4a1c454967aaf42a6c34598eccec0561fb8b (patch)
tree450b015abc6cb4bcb9dd97722b1092c99efa10c1
parente261055eafef6ea40fa5fd1c0b2590b34aaec392 (diff)
parent07e0e06f8a255a73d181e332dd8658814eb1ca50 (diff)
downloadcpython-64df4a1c454967aaf42a6c34598eccec0561fb8b.zip
cpython-64df4a1c454967aaf42a6c34598eccec0561fb8b.tar.gz
cpython-64df4a1c454967aaf42a6c34598eccec0561fb8b.tar.bz2
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 a153878..3397415 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1621,7 +1621,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 614d462..eb90e93 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -117,6 +117,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.