From 054e9c84ac7c394941bba3ea1829d14dce1243fc Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 14 Jul 2021 00:27:50 +0300 Subject: bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766) Co-authored-by: Pablo Galindo --- Python/symtable.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Python/symtable.c') diff --git a/Python/symtable.c b/Python/symtable.c index 4508464ef1..64c1635fba 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 -- cgit v1.2.1