summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/coroutines.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2016-01-11 07:13:10 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2016-01-11 07:13:10 (GMT)
commit34dd59ec8446adfd5e867a6a19109294eeaa9fb7 (patch)
tree4f8f83a79cf2377bdc4388b844529b6b9c2f2d0b /Lib/asyncio/coroutines.py
parent32d1e56bda420602fd4106dbc51ea1dc6f02ba14 (diff)
parentb86abb79aac3d5fb6e30f98c758a3e2cb31bfab3 (diff)
downloadcpython-34dd59ec8446adfd5e867a6a19109294eeaa9fb7.zip
cpython-34dd59ec8446adfd5e867a6a19109294eeaa9fb7.tar.gz
cpython-34dd59ec8446adfd5e867a6a19109294eeaa9fb7.tar.bz2
merge 3.5
Diffstat (limited to 'Lib/asyncio/coroutines.py')
-rw-r--r--Lib/asyncio/coroutines.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py
index 3a92c7d..27ab42a 100644
--- a/Lib/asyncio/coroutines.py
+++ b/Lib/asyncio/coroutines.py
@@ -27,8 +27,8 @@ _YIELD_FROM = opcode.opmap['YIELD_FROM']
# before you define your coroutines. A downside of using this feature
# is that tracebacks show entries for the CoroWrapper.__next__ method
# when _DEBUG is true.
-_DEBUG = (not sys.flags.ignore_environment
- and bool(os.environ.get('PYTHONASYNCIODEBUG')))
+_DEBUG = (not sys.flags.ignore_environment and
+ bool(os.environ.get('PYTHONASYNCIODEBUG')))
try:
@@ -86,7 +86,7 @@ class CoroWrapper:
def __init__(self, gen, func=None):
assert inspect.isgenerator(gen) or inspect.iscoroutine(gen), gen
self.gen = gen
- self.func = func # Used to unwrap @coroutine decorator
+ self.func = func # Used to unwrap @coroutine decorator
self._source_traceback = traceback.extract_stack(sys._getframe(1))
self.__name__ = getattr(gen, '__name__', None)
self.__qualname__ = getattr(gen, '__qualname__', None)
@@ -283,10 +283,13 @@ def _format_coroutine(coro):
coro_frame = coro.cr_frame
filename = coro_code.co_filename
- if (isinstance(coro, CoroWrapper)
- and not inspect.isgeneratorfunction(coro.func)
- and coro.func is not None):
- filename, lineno = events._get_function_source(coro.func)
+ lineno = 0
+ if (isinstance(coro, CoroWrapper) and
+ not inspect.isgeneratorfunction(coro.func) and
+ coro.func is not None):
+ source = events._get_function_source(coro.func)
+ if source is not None:
+ filename, lineno = source
if coro_frame is None:
coro_repr = ('%s done, defined at %s:%s'
% (coro_name, filename, lineno))