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 alex.gronholm
Recipients alex.gronholm, asvetlov, gvanrossum, iritkatriel, jab, njs, tinchester, yselivanov
Date 2022-02-16.21:10:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645045857.43.0.37310327873.issue46771@roundup.psfhosted.org>
In-reply-to
Content
I'm not trying to argue that asyncio should be changed to have level cancellation or even cancel scopes as built-in (at this point), but expanding the low level API to make implementing these features possible in third party libraries without the awkward hacks we have now.

As for async-timeout, it suffers from the same problem as AnyIO and Quattro: that cancellations of the entire task can be inadvertently swallowed by the async context manager in edge cases. I hadn't even thought of the possibility of this happening until one of AnyIO's users reported just such a problem: https://github.com/agronholm/anyio/issues/374

I just couldn't think of any way to correctly support such things without at least _some_ changes to the task cancellation behavior, and allowing .cancel() to update the cancel message seemed like the least invasive option. I'm all ears if someone has a better solution.
History
Date User Action Args
2022-02-16 21:10:57alex.gronholmsetrecipients: + alex.gronholm, gvanrossum, njs, jab, asvetlov, yselivanov, tinchester, iritkatriel
2022-02-16 21:10:57alex.gronholmsetmessageid: <1645045857.43.0.37310327873.issue46771@roundup.psfhosted.org>
2022-02-16 21:10:57alex.gronholmlinkissue46771 messages
2022-02-16 21:10:57alex.gronholmcreate