summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncio/coroutines.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py
index 20c4579..1e0a704 100644
--- a/Lib/asyncio/coroutines.py
+++ b/Lib/asyncio/coroutines.py
@@ -53,6 +53,11 @@ else:
_is_native_coro_code = lambda code: (code.co_flags &
inspect.CO_COROUTINE)
+try:
+ from collections.abc import Coroutine as CoroutineABC
+except ImportError:
+ CoroutineABC = None
+
# Check for CPython issue #21209
def has_yield_from_bug():
@@ -219,6 +224,9 @@ def iscoroutinefunction(func):
_COROUTINE_TYPES = (types.GeneratorType, CoroWrapper)
+if CoroutineABC is not None:
+ _COROUTINE_TYPES += (CoroutineABC,)
+
def iscoroutine(obj):
"""Return True if obj is a coroutine object."""