From: Serhiy Storchaka Date: Thu, 27 Dec 2012 19:34:23 +0000 (+0200) Subject: Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE. X-Git-Tag: v2.7.5~109^2~13^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61006a211339f592dcb60f20ee7e478ad012556d;p=thirdparty%2FPython%2Fcpython.git Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE. --- diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index efd3c54d9a35..0a01c9ec3051 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1611,7 +1611,7 @@ class IndentSearcher(object): try: try: _tokenize.tokenize(self.readline, self.tokeneater) - 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 7642e6067a17..9429d4e66503 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -164,6 +164,9 @@ Core and Builtins Library ------- +- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by + Roger Serwy. + - Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for localhost tests.