Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-96764: rewriteasyncio.wait_for to useasyncio.timeout#98518

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kumaraditya303 merged 29 commits intopython:mainfromkumaraditya303:waitfor
Feb 16, 2023

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303kumaraditya303 commentedOct 21, 2022
edited
Loading

This PR changesasyncio.wait_for to useasyncio.timeout as its underlying implementation. It simplifies the code and makes it easy to understand the cancellation semantics as bothasyncio.timeout andasyncio.wait_for behaves similarly.

Fixes#86296
Fixes#81839
Fixes#96764

@kumaraditya303
Copy link
ContributorAuthor

This is more of a POC at this point. I think it is worth changingwait_for to usetimeout in 3.12+. This seems to fix some of the open bugs ofwait_for, I'll add those tests to make sure.

cc@gvanrossum

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You got a bit farther than I did when I tried this, but I'm still concerned why you had to modify several tests. (Also, there's one test that fails in CI, but doesn't appear to fail when I run it locally.)

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LG (one naming nit).

@kumaraditya303kumaraditya303 marked this pull request as ready for reviewOctober 24, 2022 06:03
@kumaraditya303kumaraditya303 added type-featureA feature request or enhancement topic-asyncio labelsOct 25, 2022
@gvanrossum
Copy link
Member

I had hoped to first merge one of the alternatives that can be backported to 3.10, so we can declare this fixed in 3.10. Then we would merge this one on top of that, but only in 3.11 and main.

But we could also just do a custom fix for 3.10 based on one of@twisteroidambassador's PRs. (I wish you had linked this PR to the same issue rather than creating a new issue, since it's all related.)

robsdedude reacted with rocket emoji

@gvanrossum
Copy link
Member

In particular,@twisteroidambassador has this PR:#98607

mdonoughe pushed a commit to gurumitts/pylutron-caseta that referenced this pull requestMar 11, 2023
* Switch to using asyncio.timeout instead of asyncio.wait_for`asyncio.wait_for` creates a task whereas `asyncio.timeout` avoids doing this.Fallback to using `async_timeout` when the python version is too old (<3.11)`asyncio.timeout` will become the underlying implementation for `async.wait_for` in cpython 3.12python/cpython#98518
aaugustin pushed a commit to python-websockets/websockets that referenced this pull requestApr 2, 2023
asyncio.wait_for creates a task whereas asyncio.timeout doesn't.Fallback to a vendored version of async_timeout on Python < 3.11.async.timeout will become the underlying implementation forasync.wait_for in Python 3.12:python/cpython#98518
aaugustin pushed a commit to bdraco/websockets that referenced this pull requestApr 2, 2023
asyncio.wait_for creates a task whereas asyncio.timeout doesn't.Fallback to a vendored version of async_timeout on Python < 3.11.async.timeout will become the underlying implementation forasync.wait_for in Python 3.12:python/cpython#98518
aaugustin pushed a commit to python-websockets/websockets that referenced this pull requestApr 2, 2023
asyncio.wait_for creates a task whereas asyncio.timeout doesn't.Fallback to a vendored version of async_timeout on Python < 3.11.async.timeout will become the underlying implementation forasync.wait_for in Python 3.12:python/cpython#98518
bdraco added a commit to bdraco/aiolifx that referenced this pull requestApr 10, 2023
`asyncio.wait_for` creates another tasks which leads to somerace conditions in cancelation and a performance hitcpython 3.12 will change the underlying implementation of`asyncio.wait_for` to use `asyncio.wait` but that is stilla long way off for many people:python/cpython#98518
bdraco added a commit to bdraco/python-kasa that referenced this pull requestJul 21, 2023
Fallback to using async_timeout on older pythonasyncio.wait_for has some underlying problems that are only fixed incpython 3.12. Seepython/cpython#98518
bdraco added a commit to bdraco/python-kasa that referenced this pull requestJul 21, 2023
Fallback to using async_timeout on older pythonasyncio.wait_for has some underlying problems that are only fixed incpython 3.12. Seepython/cpython#98518
bdraco added a commit to bdraco/python-kasa that referenced this pull requestJul 21, 2023
Fallback to using async_timeout on older pythonasyncio.wait_for has some underlying problems that are only fixed incpython 3.12. Seepython/cpython#98518
bdraco added a commit to bdraco/python-kasa that referenced this pull requestJul 21, 2023
Fallback to using async_timeout on older pythonasyncio.wait_for has some underlying problems that are only fixed incpython 3.12. Seepython/cpython#98518
rytilahti pushed a commit to python-kasa/python-kasa that referenced this pull requestJul 21, 2023
asyncio.wait_for has some underlying problems that are only fixed in cpython 3.12.Use async_timeout instead until the minimum supported version is 3.11+ and it can be replaced with asyncio.timeoutSeepython/cpython#98518
bdraco added a commit to bdraco/ha-HAP-python that referenced this pull requestJul 23, 2023
async_timeout does not suffer from the same raceproblems as asyncio.wait_forseepython/cpython#98518for more details
SomberNight added a commit to SomberNight/electrum that referenced this pull requestAug 4, 2023
wasted some time because asyncio.wait_for() was suppressing cancellations. [0][1][2]deja vu... [3]Looks like this is finally getting fixed in cpython 3.12 [4]So far away...In attempt to avoid encountering this again, let's try usingasyncio.timeout in 3.11, which is how upstream reimplemented wait_for in 3.12 [4], andaiorpcx.timeout_after in 3.8-3.10.[0]python/cpython#86296[1]https://bugs.python.org/issue42130[2]https://bugs.python.org/issue45098[3]kyuupichan/aiorpcX#44[4]python/cpython#98518
SomberNight added a commit to spesmilo/electrum that referenced this pull requestAug 4, 2023
wasted some time because asyncio.wait_for() was suppressing cancellations. [0][1][2]deja vu... [3]Looks like this is finally getting fixed in cpython 3.12 [4]So far away...In attempt to avoid encountering this again, let's try usingasyncio.timeout in 3.11, which is how upstream reimplemented wait_for in 3.12 [4], andaiorpcx.timeout_after in 3.8-3.10.[0]python/cpython#86296[1]https://bugs.python.org/issue42130[2]https://bugs.python.org/issue45098[3]kyuupichan/aiorpcX#44[4]python/cpython#98518
bdraco added a commit to bdraco/python-androidtv that referenced this pull requestAug 31, 2023
`asyncio.wait_for` creates another tasks which leads to some race conditions in cancelation and a performance hitcpython 3.12 will change the underlying implementation of `asyncio.wait_for` to use `asyncio.wait` but that is still a long way off for many people:python/cpython#98518
JeffLIrion pushed a commit to JeffLIrion/python-androidtv that referenced this pull requestSep 1, 2023
* Switch usage of asyncio.wait_for to async_timeout`asyncio.wait_for` creates another tasks which leads to some race conditions in cancelation and a performance hitcpython 3.12 will change the underlying implementation of `asyncio.wait_for` to use `asyncio.wait` but that is still a long way off for many people:python/cpython#98518* adjust ci
@cdce8pcdce8p mentioned this pull requestSep 18, 2023
32 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@akulakovakulakovakulakov left review comments

@gvanrossumgvanrossumgvanrossum approved these changes

@twisteroidambassadortwisteroidambassadortwisteroidambassador left review comments

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

Assignees
No one assigned
Labels
topic-asynciotype-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
5 participants
@kumaraditya303@gvanrossum@akulakov@twisteroidambassador@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp