Skip to content

bpo-37658: Fix asyncio.wait_for() to respect waited task status #21894

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 1 commit into from
Aug 26, 2020

Conversation

elprans
Copy link
Contributor

@elprans elprans commented Aug 15, 2020

Currently, if asyncio.wait_for() itself is cancelled it will always
raise CancelledError regardless if the underlying task is still
running. This is similar to a race with the timeout, which is handled
already.

https://bugs.python.org/issue37658

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
@elprans elprans requested review from 1st1 and asvetlov as code owners August 15, 2020 22:23
elprans added a commit to MagicStack/asyncpg that referenced this pull request Aug 16, 2020
`asyncio.wait_for()` currently has a bug where it raises a
`CancelledError` even when the wrapped awaitable has completed.
The upstream fix is in python/cpython#21894.  This adds a workaround
until the aforementioned PR is merged, backported and released.

Fixes: #467
Fixes: #547
Related: #468
Supersedes: #548
elprans added a commit to MagicStack/asyncpg that referenced this pull request Aug 16, 2020
`asyncio.wait_for()` currently has a bug where it raises a
`CancelledError` even when the wrapped awaitable has completed.
The upstream fix is in python/cpython#21894.  This adds a workaround
until the aforementioned PR is merged, backported and released.

Co-authored-by: Adam Liddell <[email protected]>
Fixes: #467
Fixes: #547
Related: #468
Supersedes: #548
@1st1
Copy link
Member

1st1 commented Aug 18, 2020

Closed/reopen the pr to hopefully fix unreported Travis status blocking the merge.

@1st1 1st1 merged commit a2118a1 into python:master Aug 26, 2020
@bedevere-bot
Copy link

@1st1: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @elprans for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 26, 2020
…onGH-21894)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1)

Co-authored-by: Elvis Pranskevichus <[email protected]>
@bedevere-bot
Copy link

GH-21964 is a backport of this pull request to the 3.9 branch.

@bedevere-bot
Copy link

GH-21965 is a backport of this pull request to the 3.8 branch.

@miss-islington
Copy link
Contributor

Sorry, @elprans and @1st1, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a2118a14627256197bddcf4fcecad4c264c1e39d 3.7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 26, 2020
…onGH-21894)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1)

Co-authored-by: Elvis Pranskevichus <[email protected]>
ambv pushed a commit that referenced this pull request Aug 26, 2020
…1894) (GH-21964)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1)

Co-authored-by: Elvis Pranskevichus <[email protected]>
1st1 pushed a commit that referenced this pull request Aug 26, 2020
…1894) (#21965)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1)

Co-authored-by: Elvis Pranskevichus <[email protected]>
elprans added a commit to elprans/cpython that referenced this pull request Aug 26, 2020
…pythonGH-21894)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already..
(cherry picked from commit a2118a1)

Co-authored-by: Elvis Pranskevichus <[email protected]>
@bedevere-bot
Copy link

GH-21969 is a backport of this pull request to the 3.7 branch.

elprans added a commit to MagicStack/asyncpg that referenced this pull request Aug 27, 2020
`asyncio.wait_for()` currently has a bug where it raises a
`CancelledError` even when the wrapped awaitable has completed.
The upstream fix is in python/cpython#21894.  This adds a workaround
until the aforementioned PR is merged, backported and released.

Co-authored-by: Adam Liddell <[email protected]>
Fixes: #467
Fixes: #547
Related: #468
Supersedes: #548
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
…on#21894)

Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
ods added a commit to ods/cpython that referenced this pull request May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants