[Twisted-Python] If the errbacks of a canceled Deferred are called with error other than CancelledError, is this acceptable?

Tom Prince tom.prince at ualberta.net
Thu Jun 20 23:12:25 MDT 2013


Terry Jones <terry at jon.es> writes:
> OK, maybe someone can explain the original "Well, it already raises
> `CancelledError`. Every deferred that doesn't have explicitly handle
> cancelling already does:" to me, because I didn't get it at all!

This is what happens when a deferred is cancelled:

a) If the deferred hasn't been errbacked:
   1. Call the provied canceller (provided when the deferred is constructed)
   2. If a canceller isn't provided, or if the canceller didn't
      callback/errback, then errback with CancelledError.
   3. If a canceller isn't provided, allow callback/errback to be called
      without error once.
b) If the deferred has been fired, and is waiting on another deferred,
   cancel that deferred instead.

Since most apis in twisted don't pass a canceller, the behavior is
a2+a3.

  Tom
    



More information about the Twisted-Python mailing list