[Python-Dev] Cycle collection enhancement idea

eyal.lotem+pyutils@gmail.com eyal.lotem at gmail.com
Sun Jun 29 13:33:28 CEST 2008

On Jun 29, 7:52 am, "Guido van Rossum" <gu... at python.org> wrote:
> On Sat, Jun 28, 2008 at 5:39 PM, Greg Ewing <greg.ew... at canterbury.ac.nz> wrote:
> > Nick Coghlan wrote:
> >> It's a fact of Python development: __del__ methods cannot safely reference
> >> module globals, because those globals may be gone by the time that method is
> >> invoked.
> > Speaking of this, has there been any more thought given
> > to the idea of dropping the module clearing and just
> > relying on cyclic GC?
> No, but it is an intriguing thought nevertheless. The module clearing
> causes nothing but trouble...
This is exactly what my post tried to address.
I assumed it was clear that module clearing is the wrong solution, and
that it was also clear that due to the cycles I mentioned
(global.__class__.__dict__['any_method'].func_globals['global'] is
global), all globals that have a __del__ will not be collectible.
Therefore, I proposed a solution to cycles with a __del__ in them.
Only with this solution it is possible to replace module clearing with
normal garbage collection.


> --
> --Guido van Rossum (home page:http://www.python.org/~guido/)
> _______________________________________________
> Python-Dev mailing list
> Python-... at python.orghttp://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv...

More information about the Python-Dev mailing list