]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-90431: Document cancellation behavior of asyncio.wait() and asyncio.as_comp...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 12 Jul 2026 11:01:13 +0000 (13:01 +0200)
committerGitHub <noreply@github.com>
Sun, 12 Jul 2026 11:01:13 +0000 (11:01 +0000)
gh-90431: Document cancellation behavior of asyncio.wait() and asyncio.as_completed() (GH-153616)
(cherry picked from commit dd2faeb33d5fa0d2635b91ece6eaebd34c61408c)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Doc/library/asyncio-task.rst

index 63bb4bae9bddbb8831e6317883777426e0d306a1..16f04e6c745a1583a3c7e475dd5967297bee6c89 100644 (file)
@@ -929,6 +929,9 @@ Waiting primitives
    Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the
    futures when a timeout occurs.
 
+   If ``wait()`` is cancelled, the futures in *aws* are not cancelled
+   and continue to run.
+
    .. versionchanged:: 3.10
       Removed the *loop* parameter.
 
@@ -986,6 +989,10 @@ Waiting primitives
    are done. This is raised by the ``async for`` loop during asynchronous
    iteration or by the coroutines yielded during plain iteration.
 
+   ``as_completed()`` does not cancel the tasks running the supplied
+   awaitables: if a timeout occurs or the iteration is cancelled, the
+   remaining tasks continue to run.
+
    .. versionchanged:: 3.10
       Removed the *loop* parameter.