Message268893
| Author |
JohannesEbke |
| Recipients |
JohannesEbke, MartinAltmayer, gvanrossum, tatellos, vstinner, yselivanov |
| Date |
2016-06-20.11:27:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1466422040.03.0.352357258375.issue26923@psf.upfronthosting.co.za> |
| In-reply-to |
|
| Content |
Right, that's neater. Attached is a patch with your version and a test. I checked that it fails with the old version of cancel() and passes with the new one.
Concerning possible other bugs, I've had a look in the standard library, but could not find another instance where Future.cancel() is overwritten and has special handling. I also had a look at the try/except Exception blocks in lib/asyncio, but possible Cancellations are handled correctly there.
I believe the main source of bugs in this context will probably be other asyncio-based libraries. Either by inadvertently catching CancellationErrors in a try/except Exception block and treating them like other errors, or by not protecting resources with try/finally across yield points which might throw a CancellationError.
Not all libraries use cancel() internally, so the authors might not be aware that they have to write "cancellation-safe" code. |
|