On 10:26 am, te...@jon.es wrote:
Hi Tom
Since most apis in twisted don't pass a canceller, the behavior is a2+a3.

Right. That was the intention (glyph's). It was expected that over time
more Twisted apis that create deferreds would add cancellers. As I
understand it, Kai Zhang is now adding cancellers to some apis returning
deferreds, starting with the POP3 client.

Based on JP's comment, I still think I'm missing something here.

The only suggestion I've been making is that, if we wanted to, we could
allow a value to be passed to the cancel call. That would allow errback
functions to receive more information when a Deferred is canceled. You'd
still get a CancelledError in any case, but the value would be in the
exception instance as args[0], as in

An idea very much like this was discussed when Deferred cancellation was being implemented. My recollection is that it was ultimately explicitly rejected, though I don't remember why nor do I find discussion of it on the ticket (#990) (lack of this information somewhere seems like a failure of the development process). I admit the idea of being able to get additional information passed through the system seems appealing to me, but *not* having any additional information does simplify the interface. Considering how much trouble people already have with Deferreds without even bringing cancellation into play, maybe the simpler interface is a good thing.

My earlier point was that any Deferred for which cancellation is not already explicitly implemented already has a cancellation behavior: it will fire its errback chain with `CancelledError`. It is an incompatible change to replace this with a different exception type - such as `ConnectionDone`.

This is slightly different than your suggestion, Terry, I think - in that you propose sticking more information onto the `CancelledError`, not changing the type of the `Failure` that is sent down the errback chain. However, the thread was started specifically with the question of whether changing `CancelledError` to `ConnectionDone` is acceptable and that's the point I was mainly focused on.

Jean-Paul

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to