[Python-Dev] test___all__ polluting sys.modules?
solipsis at pitrou.net
Sun Dec 30 22:52:37 CET 2012
On Mon, 31 Dec 2012 10:25:25 +1300
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Richard Oudkerk wrote:
> > Personally I would like to get rid of the "purge globals" behaviour for
> > modules deleted before shutdown has started: if someone manipulates
> > sys.modules then they can just call gc.collect() if they want to
> > promptly get rid of orphaned reference cycles.
> Now that we have cyclic gc, is there any need for the
> shutdown purge at all?
If you have an object with a __del__ method as a module global, the
cyclic gc will refuse to consider the module globals at all (which
means it will affect unrelated objects).
So, yes, I think the shutdown purge is still necessary. Perhaps there
are ways to make it smarter.
More information about the Python-Dev