From: Benjamin Peterson Date: Sun, 8 Jun 2014 00:47:41 +0000 (-0700) Subject: document TokenError and unclosed expression behavior (closes #12063) X-Git-Tag: v2.7.8~37^2~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=806f9d704fa90d334c77a649ed59c1f4c4bdcea7;p=python document TokenError and unclosed expression behavior (closes #12063) Patch by Amandine Lee. --- diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst index 0fc0d7ef1b..3f25a2cbc0 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 f6449ba873..d16f1cd165 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