From 73df00f7d3d15ad353cbc9cabd7647db5efcec1d Mon Sep 17 00:00:00 2001 From: kovan Date: Tue, 3 Feb 2026 22:57:59 +0100 Subject: [PATCH] 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 --- Doc/library/asyncio-task.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 863b3e336572aa..710274af81ddbf 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -766,6 +766,11 @@ Timeouts The context manager produced by :func:`asyncio.timeout` can be rescheduled to a different deadline and inspected. + .. note:: + + Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` + rather than instantiating :class:`Timeout` directly. + .. class:: Timeout(when) An :ref:`asynchronous context manager `