]> granicus.if.org Git - python/commitdiff
Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Dec 2012 19:38:04 +0000 (21:38 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Dec 2012 19:38:04 +0000 (21:38 +0200)
Patch by Roger Serwy.

Lib/idlelib/EditorWindow.py
Misc/NEWS

index 48aabc8f69aadd2ffd286c31ec625b13500672df..16f63c52a40b4f487cb5d9104d6cd3ee054da53b 100644 (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
index 08d3e36c81c8fad72e9a689f6407e14bdc708634..d13a40646a5bcb8a86beeda125b70f089ae17211 100644 (file)
--- 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.