[Python-Dev] Cycle collection enhancement idea

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

> Firstly, as I said above: you will still have __del__ ordering issues.

Can you please elaborate? What would such __del__ ordering issues be?

> Secondly, the destructor itself currently calls __del__, so if you
> call __del__ before any deallocation, it will get called again as part
> of the deallocation.  Might be a technicality but it will still
> probably require some code restructuring to work around (or making
> that code even more hairy).

There could be a global barricade for calling __del__: you first call
all __del__s of existing objects, then set the barricade, and then
start breaking cycles.

This could even be done with the current approach to module clearing.


More information about the Python-Dev mailing list