anyio provides a nice context manager that works in both asyncio and trio: ``` import anyio
async def async_fn(): with anyio.move_on_after(1.0) as scope: async with lock: scope.deadline = math.inf await do_things_with_lock() ``` _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/F2KFDUD76HMFYFJEIMGOETAZYTKUUZFZ/ Code of Conduct: http://python.org/psf/codeofconduct/