Repository navigation
Rewrite asyncio.wait_for using asyncio.timeout #96764
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancement3.12only security fixesonly security fixes
on Sep 12, 2022 Note that whatever we do should preserve all the existing behavior in
wait_for(). Breaking existing code using it would be worse than keeping a bunch of issues that people can avoid by switching to usingtimeout()directly.@graingert IIRC you had a branch for this, interested in this?
Yeah I'm interested, but one thing to note is that wait_for has changed dramatically between versions so matching the behavior is hard
Yeah I'm interested, but one thing to note is that wait_for has changed dramatically between versions so matching the behavior is hard
It can be evaluated by checking how many tests it breaks by just changing it to use
asyncio.timeoutand take it from there.#31847 (comment) here's the work so far
When can we expect it to be released?
And under what patch number?3.12
Reacted by Evgenii DenisovJust want to note on this issue that this change is an unfortunate compatibility break in our Temporal deterministic event loop implementation. We can deterministically implement
call_laterbecause it's relative time, but nowwait_foruses fixed time ofcall_atwhich our time-travelling event loop can't support. I am looking into options...
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Over the years a lot of issues have accumulated for
asyncio.wait_forand the code has become complicated. Theasyncio.timeoutcan be used to simplify this a lot and will also fix bugs which are already fixed or don't exist inasyncio.timeout. This rewrite won't be backported.asyncio.wait_forshould be nothing more than a wrapper aroundasyncio.timeout.asyncio.wait_forissues: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+wait_for+label%3Aexpert-asyncioLinked PRs
asyncio.wait_forto useasyncio.timeout#98518