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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/F2KFDUD76HMFYFJEIMGOETAZYTKUUZFZ/
Code of Conduct: http://python.org/psf/codeofconduct/