This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tinchester
Recipients asvetlov, gvanrossum, iritkatriel, njs, tinchester, yselivanov
Date 2022-02-16.18:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645035168.46.0.808388594914.issue46771@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-02-16 18:12:48tinchestersetrecipients: + tinchester, gvanrossum, njs, asvetlov, yselivanov, iritkatriel
2022-02-16 18:12:48tinchestersetmessageid: <1645035168.46.0.808388594914.issue46771@roundup.psfhosted.org>
2022-02-16 18:12:48tinchesterlinkissue46771 messages
2022-02-16 18:12:48tinchestercreate