[Twisted-Python] Deferred question

James Y Knight foom at fuhm.net
Tue Dec 9 12:10:45 EST 2008


On Dec 9, 2008, at 4:09 AM, Gabriel Rossetti wrote:
> Forget it, I monkey-patched defer.Deferred to add __del__ to see if  
> it was called, and it was, so they are getting destroyed...

BTW, that is not a good way to tell if objects are being deleted.  
Simply the act of adding a __del__ to an object can *cause* it to be  
not collected, due to the way python's GC works. Luckily that was not  
the case here. :) A better method to tell if objects are being  
collected is to create a list of weakrefs (with callbacks to print a  
message, say) to the objects.

James




More information about the Twisted-Python mailing list