Skip to content

Commit 73df00f

Browse files
kovanclaude
andcommitted
gh-142044: Add note to prefer asyncio.timeout/timeout_at over Timeout
Document that users should prefer using asyncio.timeout() or asyncio.timeout_at() rather than directly instantiating the Timeout class, matching the guidance already present in the source code. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7e2c9bd commit 73df00f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/asyncio-task.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,11 @@ Timeouts
766766
The context manager produced by :func:`asyncio.timeout` can be
767767
rescheduled to a different deadline and inspected.
768768

769+
.. note::
770+
771+
Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at`
772+
rather than instantiating :class:`Timeout` directly.
773+
769774
.. class:: Timeout(when)
770775

771776
An :ref:`asynchronous context manager <async-context-managers>`

0 commit comments

Comments
 (0)