On Wed, Oct 14, 2009 at 3:16 PM, Neil Schemenauer <n...@arctrix.com> wrote:

> The current shutdown code in pythonrun.c zaps module globals by
> setting them to None (an attempt to break reference cycles). That
> causes problems since __del__ methods can try to use the globals
> after they have been set to None.
>
> The procedure implemented by http://bugs.python.org/issue812369
> seems to be a better idea. References to modules are replaced by
> weak references and the GC is allowed to cleanup reference cycles.
>

Based on the description, it still resorts to zapping module globals by
setting them to None.  It zaps them to weakrefs first, which means that
globals are more likely to be valid during __del__, but it still cannot make
any guarantees and referencing globals from __del__ is still a bad idea.  Is
that a correct synopsis?

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to