Message413347
I've essentially forked `async-timeout` (a very good library) into Quattro cancel scopes: https://github.com/Tinche/quattro/blob/main/src/quattro/cancelscope.py.
The differences are:
* the API follows Trio, so instead of `timeout` you'd use `fail_after` or `move_on_after`
* instead of `async with timeout`, you use a normal context manager `with fail_after`. The Trio folks think this is important (less suspension points, less race conditions) and I agree
* it's somewhat composable (as much as possible under asyncio), each scope knows if the CancelError is meant for it or should be propagated further. This is implemented by using the CancelError message to carry a nonce. This only works on 3.9+, but here that's not a problem
* small deadline adjustment differences, I use a setter on the deadline instead of `update` and `shift`
* it's fully type annotated, but so is Andrew's
Let me know if this sounds interesting. |
|
Date |
User |
Action |
Args |
2022-02-16 18:12:48 | tinchester | set | recipients:
+ tinchester, gvanrossum, njs, asvetlov, yselivanov, iritkatriel |
2022-02-16 18:12:48 | tinchester | set | messageid: <1645035168.46.0.808388594914.issue46771@roundup.psfhosted.org> |
2022-02-16 18:12:48 | tinchester | link | issue46771 messages |
2022-02-16 18:12:48 | tinchester | create | |
|