summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-13 19:22:03 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-13 19:22:03 (GMT)
commitaf928b65fce14ef2d5bb5bd3bc90381e61d71e34 (patch)
tree1a68290cb5f4dfaca012b6b9e136dc0f8b43e2e0 /Lib/asyncio
parent53ffdbd6f0fc18e2a58a949233626b91e4988b29 (diff)
parentc58cca5951ebab752020750e52334300342e54db (diff)
downloadcpython-af928b65fce14ef2d5bb5bd3bc90381e61d71e34.zip
cpython-af928b65fce14ef2d5bb5bd3bc90381e61d71e34.tar.gz
cpython-af928b65fce14ef2d5bb5bd3bc90381e61d71e34.tar.bz2
asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine.
Diffstat (limited to 'Lib/asyncio')
-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."""