[New-bugs-announce] [issue34349] asyncio.wait should accept generator of tasks as first argument

Nic Watson report at bugs.python.org
Mon Aug 6 15:41:06 EDT 2018


New submission from Nic Watson <pythonbugs at nicwatson.org>:

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__).

----------
components: asyncio
messages: 323217
nosy: asvetlov, jnwatson, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.wait should accept generator of tasks as first argument
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34349>
_______________________________________


More information about the New-bugs-announce mailing list