8000 bpo-44176: Allow `asyncio.as_completed()`'s first parameter to be a generator yielding awaitables by alexdelorenzo · Pull Request #26228 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44176: Allow asyncio.as_completed()'s first parameter to be a generator yielding awaitables #26228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use inspect.isawaitable() to detect if wait()'s first parameter is aw…
…aitable
  • Loading branch information
alexdelorenzo committed Jun 2, 2021
commit f75ef19afe67a9656c1bd3b80ca37ac2a555b30e
2 changes: 1 addition & 1 deletion Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ async def wait(fs, *, timeout=None, return_when=ALL_COMPLETED):
Note: This does not raise TimeoutError! Futures that aren't done
when the timeout occurs are returned in the second set.
"""
if futures.isfuture(fs) or coroutines.iscoroutine(fs):
if futures.isfuture(fs) or inspect.isawaitable(fs):
raise TypeError(f"expect a list of futures, not {type(fs).__name__}")
if not fs:
raise ValueError('Set of coroutines/Futures is empty.')
Expand Down
0