Skip to content
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

GH-95097: fix asyncio.run for tasks without uncancel method #95211

Merged
merged 7 commits into from Jul 28, 2022

Conversation

Lib/asyncio/runners.py Outdated Show resolved Hide resolved
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
@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

Lib/asyncio/runners.py Outdated Show resolved Hide resolved
1st1
1st1 approved these changes Jul 25, 2022
Copy link
Member

@1st1 1st1 left a comment

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

bedevere-bot commented Jul 25, 2022

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

kumaraditya303 commented Jul 26, 2022

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

@bedevere-bot
Copy link

bedevere-bot commented Jul 26, 2022

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 Jul 26, 2022
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
@ambv ambv self-requested a review Jul 26, 2022
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
Copy link
Member

@gvanrossum gvanrossum left a comment

Kumar all this needs is two nits to be fixed.

Lib/asyncio/runners.py Outdated Show resolved Hide resolved
@kumaraditya303
Copy link
Contributor Author

kumaraditya303 commented Jul 27, 2022

Kumar all this needs is two nits to be fixed.

On it.

@kumaraditya303 kumaraditya303 requested a review from gvanrossum Jul 27, 2022
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
@gvanrossum
Copy link
Member

gvanrossum commented Jul 27, 2022

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

gvanrossum commented Jul 27, 2022

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
14 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Jul 28, 2022

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
Copy link

bedevere-bot commented Jul 28, 2022

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

@kumaraditya303 kumaraditya303 deleted the uncancel branch Jul 28, 2022
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.

None yet

8 participants