diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-13 19:21:41 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-13 19:21:41 (GMT) |
commit | c58cca5951ebab752020750e52334300342e54db (patch) | |
tree | 455dd44e9fb94dfacfa58b26198d1cac4ee8be0d /Lib/asyncio | |
parent | d08c363c26f8437dddf3e4babd8065ab3a361518 (diff) | |
download | cpython-c58cca5951ebab752020750e52334300342e54db.zip cpython-c58cca5951ebab752020750e52334300342e54db.tar.gz cpython-c58cca5951ebab752020750e52334300342e54db.tar.bz2 |
asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine (in 3.5)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/coroutines.py | 8 |
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.""" |