diff options
author | Justin Turner Arthur <justinarthur@gmail.com> | 2024-04-01 17:07:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 17:07:29 (GMT) |
commit | c741ad3537193c63fe697a8f0316aecd45eeb9ba (patch) | |
tree | 4dc0eaac7cde2150ee10811779f1f62177524dc3 /Doc/whatsnew | |
parent | ddf814db744006e0f42328aa15ace97c9d8ad681 (diff) | |
download | cpython-c741ad3537193c63fe697a8f0316aecd45eeb9ba.zip cpython-c741ad3537193c63fe697a8f0316aecd45eeb9ba.tar.gz cpython-c741ad3537193c63fe697a8f0316aecd45eeb9ba.tar.bz2 |
gh-77714: Provide an async iterator version of as_completed (GH-22491)
* as_completed returns object that is both iterator and async iterator
* Existing tests adjusted to test both the old and new style
* New test to ensure iterator can be resumed
* New test to ensure async iterator yields any passed-in Futures as-is
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.13.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 45f7f50..97bee4d 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -289,6 +289,13 @@ asyncio forcefully close an asyncio server. (Contributed by Pierre Ossman in :gh:`113538`.) +* :func:`asyncio.as_completed` now returns an object that is both an + :term:`asynchronous iterator` and a plain :term:`iterator` of awaitables. + The awaitables yielded by asynchronous iteration include original task or + future objects that were passed in, making it easier to associate results + with the tasks being completed. + (Contributed by Justin Arthur in :gh:`77714`.) + base64 ------ |