From: Serhiy Storchaka Date: Thu, 27 Dec 2012 19:38:04 +0000 (+0200) Subject: Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE. X-Git-Tag: v3.3.1rc1~474^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07e0e06f8a255a73d181e332dd8658814eb1ca50;p=thirdparty%2FPython%2Fcpython.git 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 48aabc8f69aa..16f63c52a40b 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 08d3e36c81c8..d13a40646a5b 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.