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

@ -155,7 +155,10 @@ class BaseEventLoop(events.AbstractEventLoop):
"""Schedule a coroutine object.
Return a task object."""
return tasks.Task(coro, loop=self)
task = tasks.Task(coro, loop=self)
if task._source_traceback:
del task._source_traceback[-1]
return task
def _make_socket_transport(self, sock, protocol, waiter=None, *,
extra=None, server=None):