Commit ff542236 authored by Yury Selivanov's avatar Yury Selivanov

Issue 24017: Use abc.Coroutine in inspect.iscoroutine() function

parent f3e40fac
...@@ -212,8 +212,7 @@ def isgenerator(object): ...@@ -212,8 +212,7 @@ def isgenerator(object):
def iscoroutine(object): def iscoroutine(object):
"""Return true if the object is a coroutine.""" """Return true if the object is a coroutine."""
return (isinstance(object, types.GeneratorType) and return isinstance(object, collections.abc.Coroutine)
object.gi_code.co_flags & (CO_COROUTINE | CO_ITERABLE_COROUTINE))
def istraceback(object): def istraceback(object):
"""Return true if the object is a traceback. """Return true if the object is a traceback.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment