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
asyncio.wait should accept generator of tasks as first argument #78530
Comments
Currently, passing a generator of coroutines or futures as the first parameter of asyncio.wait raises a TypeError. This is in conflict with the documentation calling the first parameter a "sequence". Line in question. https://github.com/python/cpython/blob/3.7/Lib/asyncio/tasks.py#L347 Generators are indeed coroutines, so the check to validate that the first parameter is not a coroutine or a future is too specific. I'd suggest replacing that line with a check that the passed-in parameter is iterable, i.e. hasattr(futures, __iter__). |
Since we're deprecating generator-based coroutines anyways, I too think that the check can be relaxed. |
Since generator based coroutines are gone, I think we should relax this check and allow generators. |
Allowing generators in 3.12 seems like a good idea. It's probably also useful to change the documentation in 3.10 and 3.11 to clarify that generators don't work, as #99936 asked for. |
Let's do it. |
So there are two separate tasks here, right:
|
jnwatson mannequin commentedAug 6, 2018
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: