From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 12 Jul 2026 11:01:38 +0000 (+0200) Subject: [3.14] gh-90431: Document cancellation behavior of asyncio.wait() and asyncio.as_comp... X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=bb29dc2e750c83fbf0369388a81cb02cb3a34f08;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-90431: Document cancellation behavior of asyncio.wait() and asyncio.as_completed() (GH-153616) (#153618) gh-90431: Document cancellation behavior of asyncio.wait() and asyncio.as_completed() (GH-153616) (cherry picked from commit dd2faeb33d5fa0d2635b91ece6eaebd34c61408c) Co-authored-by: Kumar Aditya --- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 9ff833dbe857..42af2424e19b 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -942,6 +942,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. @@ -999,6 +1002,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.