Guido van Rossum <gu...@python.org> added the comment:

So I just realized that the OP's description is slightly misleading. (Their 
code is spot on though!)

The code does not create an unwaited-for *task*, assuming that "task" refers to 
the asyncio.Task class.

What is created is a *coroutine* object that's never awaited (as the quoted 
RuntimeWarning message says: "coroutine 'foo' was never awaited").

So the thing that needs to be closed in the bowels of _ensure_future() is 
indeed the argument (coro_or_future), in case it is a coroutine object.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26552>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to