Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await not allowed in comprehension in async def #5315

Closed
youknowone opened this issue May 9, 2024 · 2 comments · Fixed by #5334
Closed

await not allowed in comprehension in async def #5315

youknowone opened this issue May 9, 2024 · 2 comments · Fixed by #5334
Labels
A-compiler Area: compiler C-compat A discrepancy between RustPython and CPython

Comments

@youknowone
Copy link
Member

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

@youknowone youknowone added C-compat A discrepancy between RustPython and CPython A-compiler Area: compiler labels May 9, 2024
@hydrogen602
Copy link
Contributor

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

@youknowone
Copy link
Member Author

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
Labels
A-compiler Area: compiler C-compat A discrepancy between RustPython and CPython
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants