This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio.wait should accept generator of tasks as first argument
Type: Stage:
Components: asyncio Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, epiphyte, jnwatson, xtreak, yselivanov
Priority: normal Keywords:

Created on 2018-08-06 19:41 by jnwatson, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg323217 - (view) Author: Nic Watson (jnwatson) Date: 2018-08-06 19:41
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__).
msg323241 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-08-07 14:20
Since we're deprecating generator-based coroutines anyways, I too think that the check can be relaxed.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78530
2018-08-07 14:20:15yselivanovsetmessages: + msg323241
versions: + Python 3.8, - Python 3.7
2018-08-07 09:56:50xtreaksetnosy: + xtreak
2018-08-06 21:11:56epiphytesetnosy: + epiphyte
2018-08-06 19:41:06jnwatsoncreate