[Twisted-Python] Deferred question

Gabriel Rossetti gabriel.rossetti at arimaz.com
Wed Dec 10 00:28:22 MST 2008


James Y Knight wrote:
> 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
>
Thank you for the tip James!

Gabriel




More information about the Twisted-Python mailing list