Skip to content

[3.11] Refer to TimeoutError instead of asyncio.TimeoutError in asyncio-task.rst (GH-106136) #106180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -601,16 +601,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