This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: await is not supported in f-string in 3.6
Type: behavior Stage: resolved
Components: Documentation, Interpreter Core Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Elena.Oat, Mariatta, docs@python, eric.smith, miss-islington, ned.deily, rohitsanjay, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2020-02-03 18:26 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18433 closed Elena.Oat, 2020-02-10 19:58
PR 18434 merged Elena.Oat, 2020-02-10 20:05
PR 18456 merged serhiy.storchaka, 2020-02-11 10:29
PR 18459 merged serhiy.storchaka, 2020-02-11 12:36
PR 18505 merged miss-islington, 2020-02-13 23:58
PR 18506 merged miss-islington, 2020-02-13 23:58
Messages (12)
msg361317 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-03 18:26
The following code is compiled in 3.7, but is a syntax error in 3.6.

async def f(x):
    f"{await x}"

I have not found mentioning this change in What's New, and it looks grammatically correct. It looks as a bug in 3.6.

It may be too later to fix it in 3.6, but at least it should be documented.
msg361322 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2020-02-03 19:00
The answer I got from Yury before was: "Before 3.7 async and await were not proper keywords, so the interpreter did not recognize them in some contexts."
msg361338 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-04 07:27
Yes, await was recognized only in asynchronous functions. f-strings involve a separate parsing step for subexpressions, and it is not aware that it is in an asynchronous function. Seems the fix was unintentional, but it should documented in any case.
msg361348 - (view) Author: Rohit Sanjay (rohitsanjay) * Date: 2020-02-04 14:49
Hey, I'd like to work on this issue. Seems like an easy fix. Can you please help me out with where I will need to add the documentation for this?
msg361706 - (view) Author: Elena Oat (Elena.Oat) * Date: 2020-02-10 18:38
There was no update on this since 02/04, so I will work on this as I am at the PyCascades sprints right now.
msg361718 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-02-10 20:28
New changeset a2963f09629a0a8c63e9acef79c1dcc0a040ddb6 by Elena Oat in branch '3.6':
bpo-39545: docs: do not use await in f-strings (GH-18434)
msg361719 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-02-10 20:30
Thanks for the PR!  We don't normally accept doc changes for branches in security-fix mode but this seems like a worthwhile exception.
msg361794 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-11 10:28
Needed also notes in 3.7+.
msg361973 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-02-13 23:54
New changeset cebe9ee988837b292f2c571e194ed11e7cd4abbb by Serhiy Storchaka in branch '3.6':
bpo-39545: Document restrictions on "await" and "async for" in f-strings. (GH-18459)
msg361974 - (view) Author: miss-islington (miss-islington) Date: 2020-02-13 23:57
New changeset f632736023502816f2e6bd714d1b48c81aa2ccc1 by Serhiy Storchaka in branch 'master':
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
msg361975 - (view) Author: miss-islington (miss-islington) Date: 2020-02-14 00:03
New changeset 46cf4fc8a5646ca35f7d1ac06d2ef33eb9efca1d by Miss Islington (bot) in branch '3.7':
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
msg361976 - (view) Author: miss-islington (miss-islington) Date: 2020-02-14 00:04
New changeset 581b8606ca0609cf36c4eb9a5bb025eb77540e5e by Miss Islington (bot) in branch '3.8':
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83726
2020-02-14 08:05:34serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.6
2020-02-14 00:04:03miss-islingtonsetmessages: + msg361976
2020-02-14 00:03:19miss-islingtonsetmessages: + msg361975
2020-02-13 23:58:10miss-islingtonsetpull_requests: + pull_request17882
2020-02-13 23:58:02miss-islingtonsetpull_requests: + pull_request17881
2020-02-13 23:57:39miss-islingtonsetnosy: + miss-islington
messages: + msg361974
2020-02-13 23:54:07ned.deilysetmessages: + msg361973
2020-02-11 12:36:05serhiy.storchakasetpull_requests: + pull_request17833
2020-02-11 10:29:32serhiy.storchakasetstage: patch review
pull_requests: + pull_request17830
2020-02-11 10:28:04serhiy.storchakasetstatus: closed -> open
versions: + Python 3.7, Python 3.8, Python 3.9, - Python 3.6
messages: + msg361794

resolution: fixed -> (no value)
stage: resolved -> (no value)
2020-02-10 20:30:41ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg361719

stage: patch review -> resolved
2020-02-10 20:28:18ned.deilysetnosy: + ned.deily
messages: + msg361718
2020-02-10 20:05:36Elena.Oatsetpull_requests: + pull_request17808
2020-02-10 19:58:04Elena.Oatsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17807
2020-02-10 18:38:32Elena.Oatsetnosy: + Elena.Oat
messages: + msg361706
2020-02-04 14:49:45rohitsanjaysetnosy: + rohitsanjay
messages: + msg361348
2020-02-04 11:55:45xtreaksetnosy: + yselivanov
2020-02-04 07:27:40serhiy.storchakasetmessages: + msg361338
2020-02-03 19:00:06Mariattasetnosy: + Mariatta
messages: + msg361322
2020-02-03 18:26:38serhiy.storchakacreate