summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-05 23:33:36 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-05 23:33:36 (GMT)
commit996dd4a666a221c65df6712042c37900931ccf14 (patch)
treef82b3a04562c03d0cbd4489fdb4a27431e0de1e7 /Lib/asyncio
parentd2c5fab7c618b8c94b42ff4ae8c1875cc521f09d (diff)
parent8dc3e438398046c6bb989e038cd08280aa356982 (diff)
downloadcpython-996dd4a666a221c65df6712042c37900931ccf14.zip
cpython-996dd4a666a221c65df6712042c37900931ccf14.tar.gz
cpython-996dd4a666a221c65df6712042c37900931ccf14.tar.bz2
Merge 3.5 (issue #28372)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/coroutines.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py
index 5cecc76..1db7030 100644
--- a/Lib/asyncio/coroutines.py
+++ b/Lib/asyncio/coroutines.py
@@ -261,6 +261,25 @@ def iscoroutine(obj):
def _format_coroutine(coro):
assert iscoroutine(coro)
+ if not hasattr(coro, 'cr_code') and not hasattr(coro, 'gi_code'):
+ # Most likely a Cython coroutine.
+ coro_name = getattr(coro, '__qualname__', coro.__name__)
+ coro_name = '{}()'.format(coro_name)
+
+ running = False
+ try:
+ running = coro.cr_running
+ except AttributeError:
+ try:
+ running = coro.gi_running
+ except AttributeError:
+ pass
+
+ if running:
+ return '{} running'.format(coro_name)
+ else:
+ return coro_name
+
coro_name = None
if isinstance(coro, CoroWrapper):
func = coro.func