From 07e0e06f8a255a73d181e332dd8658814eb1ca50 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 27 Dec 2012 21:38:04 +0200 Subject: Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE. Patch by Roger Serwy. --- Lib/idlelib/EditorWindow.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 @@ 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 08d3e36..d13a406 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. -- cgit v0.12