Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-102748: remove legacy support for generator based coroutines from asyncio.iscoroutine #102749

Merged
merged 8 commits into from
Mar 16, 2023
Merged
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ asyncio
* Add C implementation of :func:`asyncio.current_task` for 4x-6x speedup.
(Contributed by Itamar Ostricher and Pranav Thulasiram Bhat in :gh:`100344`.)

* :func:`asyncio.iscoroutine` now returns :const:`False` for generators as
kumaraditya303 marked this conversation as resolved.
Show resolved Hide resolved
:mod:`asyncio` does not supports legacy generator based coroutines.
kumaraditya303 marked this conversation as resolved.
Show resolved Hide resolved
(Contributed by Kumar Aditya in :gh:`102748`.)

inspect
-------

Expand Down
3 changes: 1 addition & 2 deletions Lib/asyncio/coroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def iscoroutinefunction(func):

# Prioritize native coroutine check to speed-up
# asyncio.iscoroutine.
_COROUTINE_TYPES = (types.CoroutineType, types.GeneratorType,
collections.abc.Coroutine)
_COROUTINE_TYPES = (types.CoroutineType, collections.abc.Coroutine)
_iscoroutine_typecache = set()


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:func:`asyncio.iscoroutine` now returns :const:`False` for generators as :mod:`asyncio` does not supports legacy generator based coroutines. Patch by Kumar Aditya.
AlexWaygood marked this conversation as resolved.
Show resolved Hide resolved