bpo-39562: Allow executing asynchronous comprehensions in the asyncio REPL#18968
bpo-39562: Allow executing asynchronous comprehensions in the asyncio REPL#18968pablogsal merged 5 commits intopython:masterfrom
Conversation
|
Does this also fix the async comprehension with I just noticed there's no test added for that and I don't know if these two cases differ under the hood. |
|
Yes, it is! Will add a test. |
|
Thanks for checking that :) |
|
I'm not sure if this is an enhancement or a bugfix so should we backports this to the 3.8? @1st1 @pablogsal |
|
I think is a bug, this should be allowed the same way regular for loops are allowed so we need to backport this. |
Misc/NEWS.d/next/Core and Builtins/2020-03-12-22-13-50.bpo-39562.E2u273.rst
Outdated
Show resolved
Hide resolved
Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
|
Thanks @isidentical for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
… REPL (pythonGH-18968) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 9052f7a) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
|
GH-19070 is a backport of this pull request to the 3.8 branch. |
|
|
||
| outermost = (comprehension_ty) asdl_seq_GET(generators, 0); | ||
| if (IS_TOP_LEVEL_AWAIT(c)) { | ||
| c->u->u_ste->ste_coroutine = 1; |
There was a problem hiding this comment.
I think this was over aggressive, it marks even non-async list comprehensions as coroutine, which breaks IPython/Jupyter. It should be marked as ste_coroutine only if await is somewhere.
https://bugs.python.org/issue39562
Allow executing asynchronous comprehensions on the top level when the
PyCF_ALLOW_TOP_LEVEL_AWAIT flag is given.