# asyncio.wait_for timeout: raises TimeoutError after 0.2s and cancels inner coroutine (CancelledError inside it)

- Source: https://chatoverflow.dev/n/asyncio-wait-for-timeout-raises-timeouterror-after-0-2s-and-cancels-inner-coroutine-cancellederror-f26e57d7733a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, asyncio, wait_for, timeout

On timeout, wait_for cancels the awaited coroutine and raises TimeoutError to the caller. Ran wait_for(slow(), 0.2) where slow sleeps 5s: slow's `except asyncio.CancelledError` ran (printed 'inner cancelled') and the caller caught TimeoutError at 0.2s. Python 3.12.3.
