]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (#144449)
authorkovan <xaum.io@gmail.com>
Sat, 7 Feb 2026 12:22:51 +0000 (13:22 +0100)
committerGitHub <noreply@github.com>
Sat, 7 Feb 2026 12:22:51 +0000 (12:22 +0000)
Doc/library/asyncio-task.rst

index 863b3e336572aa53a5c62eadfdf55fdd17e23cc4..1b7c8ff0c762a6c4a11753ab53b805c24ac1378b 100644 (file)
@@ -771,6 +771,9 @@ Timeouts
        An :ref:`asynchronous context manager <async-context-managers>`
        for cancelling overdue coroutines.
 
+       Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at`
+       rather than instantiating :class:`!Timeout` directly.
+
        ``when`` should be an absolute time at which the context should time out,
        as measured by the event loop's clock: