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.

classification
Title: PyCF_ALLOW_TOP_LEVEL_AWAIT + list comprehension set .CO_COROUTINE falg.
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, mbussonn, miss-islington, pablogsal
Priority: release blocker Keywords: patch

Created on 2020-07-06 15:00 by mbussonn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21357 merged mbussonn, 2020-07-06 19:25
PR 21361 merged miss-islington, 2020-07-06 21:27
PR 21362 merged pablogsal, 2020-07-06 21:29
PR 21363 merged pablogsal, 2020-07-06 21:32
PR 21365 closed miss-islington, 2020-07-06 22:30
PR 21366 merged miss-islington, 2020-07-06 22:30
PR 22109 merged miss-islington, 2020-09-04 23:40
Messages (9)
msg373128 - (view) Author: Matthias Bussonnier (mbussonn) * Date: 2020-07-06 15:00
As far as I can tell sometime in 3.8.x (likely 3.8.3) the following snippet changed result:

    import ast
    import inspect
    cell = '[x for x in l]'
    code = compile(cell, "<>", "exec", flags=getattr(ast,'PyCF_ALLOW_TOP_LEVEL_AWAIT', 0x0))

    inspect.CO_COROUTINE & code.co_flags == inspect.CO_COROUTINE


Use to be False in 3.8.2 I believe and is False after.

This is problematic when you try to detect top-level await code.
msg373130 - (view) Author: Matthias Bussonnier (mbussonn) * Date: 2020-07-06 15:05
(crossref https://github.com/ipython/ipython/issues/12422)
msg373157 - (view) Author: Matthias Bussonnier (mbussonn) * Date: 2020-07-06 19:21
https://bugs.python.org/issue39562 seem to have triggered that.
msg373176 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-07-06 21:27
New changeset bd46174a5a09a54e5ae1077909f923f56a7cf710 by Matthias Bussonnier in branch 'master':
bpo-41218: Only mark async code with CO_COROUTINE. (#21357)
https://github.com/python/cpython/commit/bd46174a5a09a54e5ae1077909f923f56a7cf710
msg373180 - (view) Author: miss-islington (miss-islington) Date: 2020-07-06 21:44
New changeset 41db8ffc59566b8552f9cce4452ee8afad00aa63 by Miss Islington (bot) in branch '3.8':
bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357)
https://github.com/python/cpython/commit/41db8ffc59566b8552f9cce4452ee8afad00aa63
msg373189 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-07-06 22:30
New changeset c2c1f1f906cdeb40576880d4b6a4f8fcbc016eb8 by Pablo Galindo in branch 'master':
bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363)
https://github.com/python/cpython/commit/c2c1f1f906cdeb40576880d4b6a4f8fcbc016eb8
msg373190 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-07-06 22:30
New changeset 6488a4a3c9790040059fc5d293e518f193daac8d by Pablo Galindo in branch '3.9':
[3.9] bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357) (GH-21362)
https://github.com/python/cpython/commit/6488a4a3c9790040059fc5d293e518f193daac8d
msg373193 - (view) Author: miss-islington (miss-islington) Date: 2020-07-06 23:30
New changeset b71ff9a5b6e60ee1209a04d2e0e58d9a2e341db3 by Miss Islington (bot) in branch '3.8':
bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363)
https://github.com/python/cpython/commit/b71ff9a5b6e60ee1209a04d2e0e58d9a2e341db3
msg376431 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-09-05 15:37
New changeset a708ae7470cf0abc58a62853c25d9bbc977f8cd1 by Miss Islington (bot) in branch '3.9':
bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363) (GH-22109)
https://github.com/python/cpython/commit/a708ae7470cf0abc58a62853c25d9bbc977f8cd1
History
Date User Action Args
2022-04-11 14:59:33adminsetgithub: 85390
2020-09-05 15:37:30pablogsalsetmessages: + msg376431
2020-09-04 23:40:34miss-islingtonsetpull_requests: + pull_request21193
2020-07-06 23:30:53miss-islingtonsetmessages: + msg373193
2020-07-06 22:31:29pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-07-06 22:30:56miss-islingtonsetpull_requests: + pull_request20511
2020-07-06 22:30:48miss-islingtonsetpull_requests: + pull_request20510
2020-07-06 22:30:23pablogsalsetmessages: + msg373190
2020-07-06 22:30:17pablogsalsetmessages: + msg373189
2020-07-06 21:44:24miss-islingtonsetmessages: + msg373180
2020-07-06 21:32:37pablogsalsetpull_requests: + pull_request20508
2020-07-06 21:29:20pablogsalsetnosy: + pablogsal
pull_requests: + pull_request20507
2020-07-06 21:27:10miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20506
2020-07-06 21:27:01lukasz.langasetmessages: + msg373176
2020-07-06 20:18:20pablogsalsetpriority: normal -> release blocker
nosy: + lukasz.langa
2020-07-06 19:25:58mbussonnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request20503
2020-07-06 19:21:26mbussonnsetmessages: + msg373157
2020-07-06 15:05:31mbussonnsetmessages: + msg373130
2020-07-06 15:00:52mbussonncreate