[Twisted-Python] Problem in failure.Failure.__init__

Brian Granger ellisonbg.net at gmail.com
Thu Feb 15 17:15:02 EST 2007


I am using Twisted in a project and have been doing so for a long
time.  Today I ran into something that is really bizzare in

I have a simple callback function that I have registered on a deferred:

def myCallback(self, result, arg1, arg2):
    do some stuff....
        raise MyException()

The resulting exception that is raised gets sent down the pipeline and
eventually I end up serializing the Failure to send it over the wire.
The problem is that the resulting Failure is massive!  From looking at
it, the Failure has the entire locals dict.  But in my case, result,
arg1, arg2, self are all really big.  I don't want to throw all of
these things into the Failure, but Twisted seems intent on doing so.
This seems like a problem to blindly have Failure pull in the locals
w/o regard to how big the locals are.  Why is this done?  Can I
prevent it?  Is this a bug?



More information about the Twisted-Python mailing list