Skip to content

Commit f632736

Browse files
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
https://bugs.python.org/issue39545
1 parent 10e87e5 commit f632736

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Doc/reference/lexical_analysis.rst

+5
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

+5
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ description.
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)