summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-08 00:47:41 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-08 00:47:41 (GMT)
commit806f9d704fa90d334c77a649ed59c1f4c4bdcea7 (patch)
tree7934856f6baec775122b54c395653e891cd61a86
parentc3e1e90221d65f6c6db1fb0b65bd48205674d7f3 (diff)
downloadcpython-806f9d704fa90d334c77a649ed59c1f4c4bdcea7.zip
cpython-806f9d704fa90d334c77a649ed59c1f4c4bdcea7.tar.gz
cpython-806f9d704fa90d334c77a649ed59c1f4c4bdcea7.tar.bz2
document TokenError and unclosed expression behavior (closes #12063)
Patch by Amandine Lee.
-rw-r--r--Doc/library/tokenize.rst18
-rw-r--r--Misc/ACKS1
2 files changed, 19 insertions, 0 deletions
diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst
index 0fc0d7e..3f25a2c 100644
--- a/Doc/library/tokenize.rst
+++ b/Doc/library/tokenize.rst
@@ -98,6 +98,24 @@ back the modified script.
.. 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
index f6449ba..d16f1cd 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -750,6 +750,7 @@ Julia Lawall
Chris Lawrence
Brian Leair
Mathieu Leduc-Hamel
+Amandine Lee
Christopher Lee
Inyeol Lee
James Lee