8000 gh-102810 Improve the sphinx docs for `asyncio.Timeout` (GH-102934) · python/cpython@84ae50c · GitHub
[go: up one dir, main page]

Skip to content

Commit 84ae50c

Browse files
miss-islingtonJosephSBoyleAlexWaygood
authored
gh-102810 Improve the sphinx docs for asyncio.Timeout (GH-102934)
(cherry picked from commit f13fdac) Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 6ffeeb2 commit 84ae50c

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

Doc/library/asyncio-task.rst

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -624,32 +624,26 @@ Timeouts
624624
The context manager produced by :func:`asyncio.timeout` can be
625625
rescheduled to a different deadline and inspected.
626626

627-
.. class:: Timeout()
627+
.. class:: Timeout(when)
628628

629629
An :ref:`asynchronous context manager <async-context-managers>`
630-
that limits time spent inside of it.
630+
for cancelling overdue coroutines.
631631

632-
.. versionadded:: 3.11
632+
``when`` should be an absolute time at which the context should time out,
633+
as measured by the event loop's clock:
634+
635+
- If ``when`` is ``None``, the timeout will never trigger.
636+
- If ``when < loop.time()``, the timeout will trigger on the next
637+
iteration of the event loop.
633638

634639
.. method:: when() -> float | None
635640

636641
Return the current deadline, or ``None`` if the current
637642
deadline is not set.
638643

639-
The deadline is a float, consistent with the time returned by
640-
:meth:`loop.time`.
641-
642644
.. method:: reschedule(when: float | None)
643645

644-
Change the time the timeout will trigger.
645-
646-
If *when* is ``None``, any current deadline will be removed, and the
647-
context manager will wait indefinitely.
648-
649-
If *when* is a float, it is set as the new deadline.
650-
651-
if *when* is in the past, the timeout will trigger on the next
652-
iteration of the event loop.
646+
Reschedule the timeout.
653647

654648
.. method:: expired() -> bool
655649

0 commit comments

Comments
 (0)
0