summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2014-06-21 11:59:25 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2014-06-21 11:59:25 (GMT)
commit47177861dd7995b4cd27acb9757f0e804e3f06e4 (patch)
tree786e2e6c3ee8790b32123b4c203ca14826036cc2 /Lib/asyncio/tasks.py
parentbd0487694c0ce55ae9d425fe9e13e21878a7d6dc (diff)
parentca7e5d3e1dd2ac82abfa425817180cdc7985d3de (diff)
downloadcpython-47177861dd7995b4cd27acb9757f0e804e3f06e4.zip
cpython-47177861dd7995b4cd27acb9757f0e804e3f06e4.tar.gz
cpython-47177861dd7995b4cd27acb9757f0e804e3f06e4.tar.bz2
merge heads
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index e6fd3d3..eaf93f8 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -32,12 +32,12 @@ from .log import logger
_DEBUG = (not sys.flags.ignore_environment
and bool(os.environ.get('PYTHONASYNCIODEBUG')))
+_PY35 = (sys.version_info >= (3, 5))
+
class CoroWrapper:
# Wrapper for coroutine in _DEBUG mode.
- __slots__ = ['gen', 'func', '__name__', '__doc__', '__weakref__']
-
def __init__(self, gen, func):
assert inspect.isgenerator(gen), gen
self.gen = gen
@@ -111,8 +111,10 @@ def coroutine(func):
@functools.wraps(func)
def wrapper(*args, **kwds):
w = CoroWrapper(coro(*args, **kwds), func)
- w.__name__ = coro.__name__
- w.__doc__ = coro.__doc__
+ w.__name__ = func.__name__
+ if _PY35:
+ w.__qualname__ = func.__qualname__
+ w.__doc__ = func.__doc__
return w
wrapper._is_coroutine = True # For iscoroutinefunction().
@@ -190,7 +192,7 @@ class Task(futures.Future):
i = len(res)
text = self._coro.__name__
coro = self._coro
- if inspect.isgenerator(coro):
+ if iscoroutine(coro):
filename = coro.gi_code.co_filename
if coro.gi_frame is not None:
text += ' at %s:%s' % (filename, coro.gi_frame.f_lineno)