bpo-34790: Implement deprecation of passing coroutines to asyncio.wait() (GH-16977)

This commit is contained in:
Kyle Stanley 2019-12-30 06:50:19 -05:00 committed by Andrew Svetlov
parent 88dce26da6
commit 89aa7f0ede
3 changed files with 28 additions and 5 deletions

View file

@ -424,6 +424,12 @@ async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
"and scheduled for removal in Python 3.10.",
DeprecationWarning, stacklevel=2)
if any(coroutines.iscoroutine(f) for f in set(fs)):
warnings.warn("The explicit passing of coroutine objects to "
"asyncio.wait() is deprecated since Python 3.8, and "
"scheduled for removal in Python 3.11.",
DeprecationWarning, stacklevel=2)
fs = {ensure_future(f, loop=loop) for f in set(fs)}
return await _wait(fs, timeout, return_when, loop)