-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-33363: raise SyntaxError for async for/with outside async functions #6616
Conversation
Python/compile.c
Outdated
@@ -2443,6 +2443,9 @@ static int | |||
compiler_async_for(struct compiler *c, stmt_ty s) | |||
{ | |||
basicblock *start, *except, *end; | |||
if (c->u->u_scope_type != COMPILER_SCOPE_ASYNC_FUNCTION) | |||
return compiler_error(c, "'async for' outside async function"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add {
per pep 7
Also need a NEWS entry. Please use |
Thanks for the review! |
@1st1: Please replace |
Sorry, @zsol and @1st1, I could not cleanly backport this to |
Thanks for the PR and opening the issue, Zsolt! |
@zsol Can you submit a separate PR against 3.7? |
…ns (python#6616) (cherry picked from commit e239650)
…unctions (pythonGH-6616). (cherry picked from commit e239650) Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
GH-6619 is a backport of this pull request to the 3.7 branch. |
This is still caught only at the compile phase (in python 3.6 it's caught even earlier).
https://bugs.python.org/issue33363