Skip to content

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

Merged
merged 7 commits into from
Jul 28, 2022

Conversation

@graingert
Copy link
Contributor

graingert commented Jul 25, 2022

I think it would be better to not set the signal handler if the task is missing the uncancel method. There's already a threading.main_thread() check

Copy link
Member

@1st1 1st1 left a 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.

@bedevere-bot
Copy link

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 have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@pablogsal
Copy link
Member

pablogsal commented Jul 25, 2022

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.

@kumaraditya303
Copy link
Contributor Author

Changed it to raise CancelledError, I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@1st1: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from 1st1 July 26, 2022 08:21
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
@ambv ambv self-requested a review July 26, 2022 10:28
Copy link
Member

@gvanrossum gvanrossum left a 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.

@kumaraditya303
Copy link
Contributor Author

Kumar all this needs is two nits to be fixed.

On it.

@gvanrossum
Copy link
Member

Looking at this comment from @1st1:

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.

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.

@gvanrossum
Copy link
Member

Oh, what's wrong with the Windows test? It fails with a byteswarning. Do we need to merge main?

@gvanrossum gvanrossum merged commit 54f4884 into python:main Jul 28, 2022
@miss-islington
Copy link
Contributor

Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2022
…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>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 28, 2022
@bedevere-bot
Copy link

GH-95387 is a backport of this pull request to the 3.11 branch.

@kumaraditya303 kumaraditya303 deleted the uncancel branch July 28, 2022 17:16
ambv pushed a commit that referenced this pull request Jul 29, 2022
…5211) (GH-95387)

(cherry picked from commit 54f4884)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-blocker type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants