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().
This commit is contained in:
Victor Stinner 2014-07-11 00:21:27 +02:00
parent f68bd88aa6
commit c39ba7d611
4 changed files with 70 additions and 15 deletions

View file

@ -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())