Ticket #4301: 3k-internet-defer-4301.2.patch
| File 3k-internet-defer-4301.2.patch, 1.6 KB (added by drtimcouper, 3 years ago) |
|---|
-
twisted/internet/defer.py
239 239 240 240 These will be executed when the 'master' callback is run. 241 241 """ 242 assert callable(callback)243 assert errback == None or callable(errback)242 assert hasattr(callback, '__call__') 243 assert errback is None or hasattr(errback, '__call__') 244 244 cbs = ((callback, callbackArgs, callbackKeywords), 245 245 (errback or (passthru), errbackArgs, errbackKeywords)) 246 246 self.callbacks.append(cbs) … … 570 570 """ 571 571 return 'FirstError[#%d, %s]' % (self.index, self.subFailure) 572 572 573 574 def __cmp__(self, other): 575 """ 576 Comparison between L{FirstError} and other L{FirstError} instances 577 is defined as the comparison of the index and sub-failure of each 578 instance. L{FirstError} instances don't compare equal to anything 579 that isn't a L{FirstError} instance. 580 581 @since: 8.2 582 """ 573 def __eq__(self, other): 583 574 if isinstance(other, FirstError): 584 return cmp( 585 (self.index, self.subFailure), 586 (other.index, other.subFailure)) 587 return -1 575 return (self.index, self.subFailure) == (other.index, other.subFailure) 576 else: 577 return False 588 578 579 def __ne__(self,other): 580 return not self.__eq__(other) 589 581 582 __hash__ = object.__hash__ 590 583 584 591 585 class DeferredList(Deferred): 592 586 """ 593 587 I combine a group of deferreds into one callback.
