[Python-Dev] Cycle collection enhancement idea

"Martin v. Löwis" martin at v.loewis.de
Sun Jun 29 20:15:07 CEST 2008


> Additionally, there is another problem: If the cycle is not
> temporarily revived, and you call __del__ manually, it may break the
> cycle by removing the references.
> Thus, objects in the cycle will go down to refcount=0 during your
> attempt to call __del__'s on the objects in the cycle.
> The only sane thing is to temporarily revive the entire cycle so you
> can safely call __del__'s on it.  Then, you might want to disable the
> normal __del__ calling that occurs as part of the later destruction of
> the cycle.

I still don't understand what "revive the cycle" means. You will need to
incref the object for which you call __del__, that's all.

Regards,
Martin


More information about the Python-Dev mailing list