[Python-checkins] bpo-39545: Document changes in the support of await in f-strings. (GH-18456)

Miss Islington (bot) webhook-mailer at python.org
Thu Feb 13 19:04:04 EST 2020


https://github.com/python/cpython/commit/581b8606ca0609cf36c4eb9a5bb025eb77540e5e
commit: 581b8606ca0609cf36c4eb9a5bb025eb77540e5e
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-02-13T16:03:59-08:00
summary:

bpo-39545: Document changes in the support of await in f-strings. (GH-18456)


https://bugs.python.org/issue39545
(cherry picked from commit f632736023502816f2e6bd714d1b48c81aa2ccc1)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
M Doc/reference/lexical_analysis.rst
M Doc/whatsnew/3.7.rst

diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index c0e13b53698e6..3d4b03e6bd459 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -685,6 +685,11 @@ strings), but they cannot contain comments.  Each expression is evaluated
 in the context where the formatted string literal appears, in order from
 left to right.
 
+.. versionchanged:: 3.7
+   Prior to Python 3.7, an :keyword:`await` expression and comprehensions
+   containing an :keyword:`async for` clause were illegal in the expressions
+   in formatted string literals due to a problem with the implementation.
+
 If a conversion is specified, the result of evaluating the expression
 is converted before formatting.  Conversion ``'!s'`` calls :func:`str` on
 the result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`.
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 8a70fe22d52bd..b9b50216d23a6 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -493,6 +493,11 @@ of this mode.
 Other Language Changes
 ======================
 
+* An :keyword:`await` expression and comprehensions containing an
+  :keyword:`async for` clause were illegal in the expressions in
+  :ref:`formatted string literals <f-strings>` due to a problem with the
+  implementation.  In Python 3.7 this restriction was lifted.
+
 * More than 255 arguments can now be passed to a function, and a function can
   now have more than 255 parameters. (Contributed by Serhiy Storchaka in
   :issue:`12844` and :issue:`18896`.)



More information about the Python-checkins mailing list