You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio.wait(aws) require aws is 'iterable', but doesn't accept generator #99936
This is presumably a holdover from generator-based coroutines, which no longer exist in recent versions of asyncio. We should consider removing GeneratorType from _COROUTINE_TYPES, but we'll have to think about whether there are any backward compatibility implications.
a more thing:
I also see "DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.".
It didn't say anything, but I guess it's asking users to .create_task() outside .wait() for comparing if the task is in the returned done set. But the document of .wait() deleted that comparing part from the example code.
It seems to make a little confuse both in DeprecationWarning and the document because they didn't match.
maybe should update the document to match the warning?
Activity
JelleZijlstra commentedon Dec 1, 2022
This is because generators are in
asyncio.coroutines._COROUTINE_TYPES: https://github.com/python/cpython/blob/main/Lib/asyncio/coroutines.py#L28. Therefore,asyncio.coroutines.iscoroutinethinks every generator is a coroutine.This is presumably a holdover from generator-based coroutines, which no longer exist in recent versions of asyncio. We should consider removing
GeneratorTypefrom_COROUTINE_TYPES, but we'll have to think about whether there are any backward compatibility implications.NewUserHa commentedon Dec 1, 2022
a more thing:
I also see "DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.".
It didn't say anything, but I guess it's asking users to
.create_task()outside.wait()for comparing if the task is in the returneddone set. But the document of.wait()deleted that comparing part from the example code.It seems to make a little confuse both in DeprecationWarning and the document because they didn't match.
maybe should update the document to match the warning?
kumaraditya303 commentedon Dec 2, 2022
Duplicate of #78530
NewUserHa commentedon Dec 2, 2022
I have seen #78530 when open issue. However, this issue is more about the document.
kumaraditya303 commentedon Dec 2, 2022
I am thinking of allowing this rather than documenting this. See my comment #78530 (comment) and let's continue the discussion on that issue.