summaryrefslogtreecommitdiff
path: root/Lib/asyncio/coroutines.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-13 15:21:41 -0400
committerYury Selivanov <yselivanov@sprymix.com>2015-05-13 15:21:41 -0400
commitc58cca5951ebab752020750e52334300342e54db (patch)
tree455dd44e9fb94dfacfa58b26198d1cac4ee8be0d /Lib/asyncio/coroutines.py
parentd08c363c26f8437dddf3e4babd8065ab3a361518 (diff)
downloadcpython-git-c58cca5951ebab752020750e52334300342e54db.tar.gz
asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine (in 3.5)
Diffstat (limited to 'Lib/asyncio/coroutines.py')
-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 20c45798dc..1e0a70497f 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."""