-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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-39562: Allow executing asynchronous comprehensions in the asyncio REPL #18968
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. |
int is_async_generator = 0; | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.