Skip to content

await not allowed in comprehension in async def #5315

Description

@youknowone

Feature

code

async def f():
    [await a for a in range(1)]

expected: No error

Actual:

  File "z.py", line 2
    [await a for a in range(1)]
     ^
SyntaxError: 'await' outside async function

Python Documentation or reference to CPython source code

Activity

  1. hydrogen602 commented on May 15, 2024

    @hydrogen602
    Contributor

    are you working on this right now? Otherwise I would like to take a stab at this and see if I get anywhere.

  2. youknowone commented on May 15, 2024

    @youknowone
    MemberAuthor

    Not yet, please go ahead. 👍
    codegen/compile.rs is related.
    propagating async function context to compile_comprehension will be the starting point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compilerArea: compilerC-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions