Skip to content

Commit bb29dc2

Browse files
[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 dd2faeb) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
1 parent b587c54 commit bb29dc2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Doc/library/asyncio-task.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,9 @@ Waiting primitives
942942
Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the
943943
futures when a timeout occurs.
944944

945+
If ``wait()`` is cancelled, the futures in *aws* are not cancelled
946+
and continue to run.
947+
945948
.. versionchanged:: 3.10
946949
Removed the *loop* parameter.
947950

@@ -999,6 +1002,10 @@ Waiting primitives
9991002
are done. This is raised by the ``async for`` loop during asynchronous
10001003
iteration or by the coroutines yielded during plain iteration.
10011004

1005+
``as_completed()`` does not cancel the tasks running the supplied
1006+
awaitables: if a timeout occurs or the iteration is cancelled, the
1007+
remaining tasks continue to run.
1008+
10021009
.. versionchanged:: 3.10
10031010
Removed the *loop* parameter.
10041011

0 commit comments

Comments
 (0)