async-timeout
async-timeout copied to clipboard
Fix race conditions, support Python 3.11
Python 3.11 tests fail, not released yet Python 3.11.0a6+ required
If this fixes the same race conditions we were looking at before, can you put the tests back in from that discussion? Seems you reverted them for some reason: https://github.com/aio-libs/async-timeout/commit/ab04eb53dcf49388b6e6eacf0a50bafe19c5c74b
Thanks, I lost these tests. Not sure if 1ms delay produces stable CI. Let me port tests and see how they work
Thanks, I lost these tests. Not sure if 1ms delay produces stable CI. Let me port tests and see how they work
It worked 100% of the times we tried it so far. If the last assert for call_order fails, then the timing went wrong. If it fails anywhere else, then the race condition is not fixed.
I think this will still fail the second test. If the timeout cancellation is followed by the explicit cancellation, then the explicit cancellation is ignored. Without fixing this, it would require a user to do something awkward everytime they cancel a task, like:
while not task.cancel():
await asyncio.sleep(0)
I think we'll still need https://bugs.python.org/issue45098 With the new ExceptionGroup, I think my suggestion should change to raising multiple CancelledErrors. Then we can replace the timeout CancelledError with a TimeoutError and reraise any other CancelledErrors.
@Dreamsorcerer you may be interested in CPython discussion about asyncio timeouts design: https://bugs.python.org/issue46771?@ok_message=msg%20413603%20created%0Aissue%2046771%20message_count%2C%20messages%20edited%20ok&@template=item
Please feel free to join us. I suggest suspending asyncio-timeout upgrading until the asyncio timeout has landed.