asyncio.as_completed as async iterator can yield tasks as well as futures
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
According to the 3.13 docs for asyncio.as_completed:
When asynchronous iteration is used, the originally-supplied awaitables are yielded if they are tasks or futures.
The relevant stub, however, has the function yield Futures irrespective of whether it was originally supplied with Futures or Tasks.
Is there a reason for this or can it be improved to reflect the actual behavior?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with stdlib/asyncio/tasks.pyi around line 93 and compare the as_completed stub with the Python 3.13 documentation linked in the issue. Check how the async-iterator result is currently typed for supplied Futures and Tasks, then verify that the final annotation reflects the documented behavior for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100