[Python-Dev] Better module shutdown procedure (original) (raw)
Daniel Stutzbach daniel at stutzbachenterprises.com
Wed Oct 14 23:13:12 CEST 2009
- Previous message: [Python-Dev] Better module shutdown procedure
- Next message: [Python-Dev] Better module shutdown procedure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Oct 14, 2009 at 3:16 PM, Neil Schemenauer <nas at 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> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20091014/a68e762b/attachment.htm>
- Previous message: [Python-Dev] Better module shutdown procedure
- Next message: [Python-Dev] Better module shutdown procedure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]