Message268893
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. |
|
Date |
User |
Action |
Args |
2016-06-20 11:27:20 | JohannesEbke | set | recipients:
+ JohannesEbke, gvanrossum, vstinner, MartinAltmayer, yselivanov, tatellos |
2016-06-20 11:27:20 | JohannesEbke | set | messageid: <1466422040.03.0.352357258375.issue26923@psf.upfronthosting.co.za> |
2016-06-20 11:27:20 | JohannesEbke | link | issue26923 messages |
2016-06-20 11:27:19 | JohannesEbke | create | |
|