Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.
Patch by Roger Serwy.
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 48aabc8..16f63c5 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1618,7 +1618,7 @@
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