[Python-Dev] Weak references: dereference notification

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 12 04:12:58 CET 2005


Gustavo J. A. M. Carneiro wrote:

>   The object isn't really destroyed.  Simply ob_refcnt drops to zero,
> then tp_dealloc is called, which is supposed to destroy it.  But since I
> wrote tp_dealloc, I choose not to destroy it,

Be aware that a C subclass of your wrapper that overrides
tp_dealloc is going to have its tp_dealloc called before
yours, and will therefore be partly destroyed before you
get control.

Greg



More information about the Python-Dev mailing list