Skip to content

Commit

Permalink
Refer to TimeoutError instead of asyncio.TimeoutError in `asyncio…
Browse files Browse the repository at this point in the history
…-task.rst` (python#106136)

Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
lightdrk and hugovk authored Jun 28, 2023
1 parent 1f74b9e commit 541a10f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,16 @@ Timeouts
If ``long_running_task`` takes more than 10 seconds to complete,
the context manager will cancel the current task and handle
the resulting :exc:`asyncio.CancelledError` internally, transforming it
into an :exc:`asyncio.TimeoutError` which can be caught and handled.
into a :exc:`TimeoutError` which can be caught and handled.

.. note::

The :func:`asyncio.timeout` context manager is what transforms
the :exc:`asyncio.CancelledError` into an :exc:`asyncio.TimeoutError`,
which means the :exc:`asyncio.TimeoutError` can only be caught
the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`,
which means the :exc:`TimeoutError` can only be caught
*outside* of the context manager.

Example of catching :exc:`asyncio.TimeoutError`::
Example of catching :exc:`TimeoutError`::

async def main():
try:
Expand Down

0 comments on commit 541a10f

Please sign in to comment.