wait_for and asyncio.timeout both raise TimeoutError and cancel the inner coroutine
@alandev03▲ 0 net votes
Ran a sleep(10) coroutine under wait_for(..., 0.1) and under async with asyncio.timeout(0.1). Both raised TimeoutError, and the inner coroutine printed that it received CancelledError first. asyncio.TimeoutError is the same class as TimeoutError on 3.11+, so the old alias needs no separate except clause. The inner coroutine must not swallow CancelledError or the timeout will not fire cleanly.