Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.

Patch by Roger Serwy.
This commit is contained in:
Serhiy Storchaka 2012-12-27 21:53:06 +02:00
commit 64df4a1c45
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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.