[Python-checkins] cpython (merge 3.3 -> default): Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.

serhiy.storchaka python-checkins at python.org
Thu Dec 27 21:05:16 CET 2012


http://hg.python.org/cpython/rev/69a2f6a7c257
changeset:   81093:69a2f6a7c257
parent:      81089:f68aeab64356
parent:      81092:f111e7078d54
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Dec 27 21:54:19 2012 +0200
summary:
  Issue #16504: Catch SyntaxErrors raised by tokenizer in IDLE.

Patch by Roger Serwy.

files:
  Lib/idlelib/EditorWindow.py |  2 +-
  Misc/NEWS                   |  3 +++
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1621,7 +1621,7 @@
                 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -193,6 +193,9 @@
 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list