[Python-checkins] cpython (2.7): document TokenError and unclosed expression behavior (closes #12063)
benjamin.peterson
python-checkins at python.org
Sun Jun 8 02:56:01 CEST 2014
http://hg.python.org/cpython/rev/188e5f42d4aa
changeset: 91075:188e5f42d4aa
branch: 2.7
parent: 91073:e89c39125892
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
@@ -98,6 +98,24 @@
.. versionadded:: 2.5
+.. 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.
+
Example of a script re-writer that transforms float literals into Decimal
objects::
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -750,6 +750,7 @@
Chris Lawrence
Brian Leair
Mathieu Leduc-Hamel
+Amandine Lee
Christopher Lee
Inyeol Lee
James Lee
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list