I think that for this functionality (force the event loop to run), the trampoline just needs to define a function that returns a magic value and special-case that. The helper then becomes
def __sleep0(): await <magic> The magic object may have to be something with an __await__() method. On Fri, Feb 19, 2021 at 01:34 Luciano Ramalho <luci...@ramalho.org> wrote: > On Fri, Feb 19, 2021 at 6:29 AM Luciano Ramalho <luci...@ramalho.org> > wrote: > > async def __sleep(): > > return None > > Sorry, I meant to write: > > async def __sleep0(): > return None > > Since the idea is to replace the generator-based coroutine `__sleep0` > in tasks.py [1] with a native coroutine. > > [1] > https://github.com/python/cpython/blob/e92d67dfbb4790df37aa6a0961fb6dc7e8d2fbbf/Lib/asyncio/tasks.py#L585 > > -- > Luciano Ramalho > | Author of Fluent Python (O'Reilly, 2015) > | http://shop.oreilly.com/product/0636920032519.do > | Technical Principal at ThoughtWorks > | Twitter: @ramalhoorg > -- --Guido (mobile)
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/IB5E552MRHZTGX3IQN6OKSDY3DDGA4D3/ Code of Conduct: http://python.org/psf/codeofconduct/