diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-07-13 21:27:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 21:27:50 (GMT) |
commit | 054e9c84ac7c394941bba3ea1829d14dce1243fc (patch) | |
tree | edd3cbe6ed6083909280d8aaed50c8d2679b4fde /Python/symtable.c | |
parent | 0ee0a740e12ec8568aafa033aa6bb08b265afe26 (diff) | |
download | cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.zip cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.tar.gz cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.tar.bz2 |
bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index 4508464..64c1635 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -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 |