bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
Serhiy Storchaka 2021-07-14 00:27:50 +03:00 committed by GitHub
parent 0ee0a740e1
commit 054e9c84ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 17 deletions

View file

@ -2056,7 +2056,14 @@ symtable_handle_comprehension(struct symtable *st, expr_ty e,
return 0;
}
st->st_cur->ste_generator = is_generator;
return symtable_exit_block(st);
int is_async = st->st_cur->ste_coroutine && !is_generator;
if (!symtable_exit_block(st)) {
return 0;
}
if (is_async) {
st->st_cur->ste_coroutine = 1;
}
return 1;
}
static int