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

Patch by Roger Serwy.
This commit is contained in:
Serhiy Storchaka 2012-12-27 21:38:04 +02:00
parent c8bd74ddfd
commit 07e0e06f8a
2 changed files with 4 additions and 1 deletions

View file

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