-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
GH-95097: fix asyncio.run
for tasks without uncancel
method
#95211
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
Conversation
I think it would be better to not set the signal handler if the task is missing the uncancel method. There's already a |
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 it was too soon for me to click "Approve".
If the uncancel()
method doesn't exist we should, IMO, just propagate the cancelled error as is. At least I don't see any reasons not to (and for emulating uncancel()
) and there's no comment explaining the current approach of the PR.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I'm not landing this into beta 5 because we should address Yuri's comments, but this will block RC1 and I don't want to steal one day for a release that's only going to be out for a week. This means that people should manually test this or use nightly builds to ensure it works once is landed. |
Changed it to raise CancelledError, I have made the requested changes; please review again |
Thanks for making the requested changes! @1st1: please review the changes made to this pull request. |
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
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.
Kumar all this needs is two nits to be fixed.
On it. |
Looking at this comment from @1st1:
We implemented that, so this should be okay. It seems clear enough from the code what is happening now so I don't believe we need another comment. |
Oh, what's wrong with the Windows test? It fails with a byteswarning. Do we need to merge main? |
Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…pythonGH-95211) Co-authored-by: Thomas Grainger <tagrain@gmail.com> (cherry picked from commit 54f4884) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
GH-95387 is a backport of this pull request to the 3.11 branch. |
AttributeError: 'Task' object has no attribute 'uncancel'. Did you mean: 'cancel'?
when the asyncioloop.set_task_factory
factory returns aasyncio.Future
-compatible object #95097