[Twisted-Python] Twisted and PEP 3148 support

Tim Allen screwtape at froup.com
Mon Jan 10 20:10:33 MST 2011


On Tue, Jan 11, 2011 at 02:15:59AM -0000, exarkun at twistedmatrix.com wrote:
> On 01:54 am, screwtape at froup.com wrote:
> >    - Futures support cancellation; Twisted finally managed to get rid
> >      of cancellation support in Deferreds.
> 
> We only got rid of Deferred.setTimeout.  In exchange, we added 
> generalized cancellation support.

Ah, yes, I misremembered. Thank you for the correction.

I haven't used Deferred's cancellation support; I don't know how
compatible it is with Future's cancellation support.

> Futures may call their callbacks in any thread.  So the line:
> >                 d.fail(e)
> 
> must instead be something like:
> 
>                 reactor.callFromThread(d.errback, e)

PEP 3148 says:
# Added callables are called in the order that they were added and are
# always called in a thread belonging to the process that added them.

I assumed that implied some kind of internal .callFromThread() magic;
I could be wrong.




More information about the Twisted-Python mailing list