[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator

Michel Desmoulin report at bugs.python.org
Mon Feb 15 04:42:11 EST 2016


Michel Desmoulin added the comment:

We fixed our bug days ago, but I would have expected [*gen] to have triggered an exception before it even got to gather().

The real code was something like:

>>> l = (ensure_awaitable(callable_obj) for callable_obj in callable_list)
>>> gather(*l)

ensure_awaitable() is just using inspect to turn coroutine functions into coroutines, and wraps non coroutine callables with asyncio.coroutine(callable)().

In the end, ensure_awaitable did raise TypeError if the argument passed was not a callable.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4806>
_______________________________________


More information about the Python-bugs-list mailing list