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 commented on 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.iscoroutine thinks 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 GeneratorType from _COROUTINE_TYPES, but we'll have to think about whether there are any backward compatibility implications.
NewUserHa commented on 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 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?
kumaraditya303 commented on Dec 2, 2022
Duplicate of #78530
NewUserHa commented on Dec 2, 2022
I have seen #78530 when open issue. However, this issue is more about the document.
kumaraditya303 commented on 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.