From c39ba7d611fe556314acc8c11cd9f805512db663 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 11 Jul 2014 00:21:27 +0200 Subject: asyncio: sync with Tulip - repr(Task) and repr(CoroWrapper) now also includes where these objects were created. If the coroutine is not a generator (don't use "yield from"), use the location of the function, not the location of the coro() wrapper. - Fix create_task(): truncate the traceback to hide the call to create_task(). --- Lib/asyncio/tasks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Lib/asyncio/tasks.py') diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index befc2967c71..61f48223ca3 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -101,7 +101,12 @@ class Task(futures.Future): else: info.append(self._state.lower()) - info.append(coroutines._format_coroutine(self._coro)) + coro = coroutines._format_coroutine(self._coro) + info.append('coro=<%s>' % coro) + + if self._source_traceback: + frame = self._source_traceback[-1] + info.append('created at %s:%s' % (frame[0], frame[1])) if self._state == futures._FINISHED: info.append(self._format_result()) -- cgit v1.2.3