Skip to content

Refer to TimeoutError instead of asyncio.TimeoutError in asyncio-task.rst #106136

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 5 commits into from
Jun 28, 2023
Merged
Changes from 3 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
12 changes: 6 additions & 6 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ other coroutines::
In this documentation the term "coroutine" can be used for
two closely related concepts:

* a *coroutine function*: an :keyword:`async def` function;
* a *coroutine function*: a :keyword:`async def` function;

* a *coroutine object*: an object returned by calling a
*coroutine function*.
Expand Down 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 Expand Up @@ -1121,7 +1121,7 @@ Task Object
If the Task has been *cancelled*, this method raises a
:exc:`CancelledError` exception.

If the Task isn't *done* yet, this method raises an
If the Task isn't *done* yet, this method raises a
:exc:`InvalidStateError` exception.

.. method:: add_done_callback(callback, *, context=None)
Expand Down