[Python-checkins] cpython (3.4): document TokenError and unclosed expression behavior (closes #12063)

benjamin.peterson python-checkins at python.org
Sun Jun 8 02:56:02 CEST 2014


http://hg.python.org/cpython/rev/ddc174c4c7e5
changeset:   91076:ddc174c4c7e5
branch:      3.4
parent:      91072:7aa72075d440
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat Jun 07 17:47:41 2014 -0700
summary:
  document TokenError and unclosed expression behavior (closes #12063)

Patch by Amandine Lee.

files:
  Doc/library/tokenize.rst |  18 ++++++++++++++++++
  Misc/ACKS                |   1 +
  2 files changed, 19 insertions(+), 0 deletions(-)


diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst
--- a/Doc/library/tokenize.rst
+++ b/Doc/library/tokenize.rst
@@ -131,6 +131,24 @@
 
    .. versionadded:: 3.2
 
+.. exception:: TokenError
+
+   Raised when either a docstring or expression that may be split over several
+   lines is not completed anywhere in the file, for example::
+
+      """Beginning of
+      docstring
+
+   or::
+
+      [1,
+       2,
+       3
+
+Note that unclosed single-quoted strings do not cause an error to be
+raised. They are tokenized as ``ERRORTOKEN``, followed by the tokenization of
+their contents.
+
 
 .. _tokenize-cli:
 
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -749,6 +749,7 @@
 Chris Lawrence
 Brian Leair
 Mathieu Leduc-Hamel
+Amandine Lee
 Antony Lee
 Christopher Lee
 Inyeol Lee

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


More information about the Python-checkins mailing list