Skip to content

Commit 581b860

Browse files
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
https://bugs.python.org/issue39545 (cherry picked from commit f632736) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 8dbdf5f commit 581b860

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,11 @@ strings), but they cannot contain comments. Each expression is evaluated
685685
in the context where the formatted string literal appears, in order from
686686
left to right.
687687

688+
.. versionchanged:: 3.7
689+
Prior to Python 3.7, an :keyword:`await` expression and comprehensions
690+
containing an :keyword:`async for` clause were illegal in the expressions
691+
in formatted string literals due to a problem with the implementation.
692+
688693
If a conversion is specified, the result of evaluating the expression
689694
is converted before formatting. Conversion ``'!s'`` calls :func:`str` on
690695
the result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`.

Doc/whatsnew/3.7.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ of this mode.
493493
Other Language Changes
494494
======================
495495

496+
* An :keyword:`await` expression and comprehensions containing an
497+
:keyword:`async for` clause were illegal in the expressions in
498+
:ref:`formatted string literals <f-strings>` due to a problem with the
499+
implementation. In Python 3.7 this restriction was lifted.
500+
496501
* More than 255 arguments can now be passed to a function, and a function can
497502
now have more than 255 parameters. (Contributed by Serhiy Storchaka in
498503
:issue:`12844` and :issue:`18896`.)

0 commit comments

Comments
 (0)