[Python-Dev] Details on Python shutting down

Aahz aahz@pythoncraft.com
Mon, 16 Jun 2003 11:04:27 -0400


On Sun, Jun 15, 2003, Brett C. wrote:
> 
> So, what exactly does Python do during shutdown?  I assume all
> objects get cleaned up and have their __del__ methods called if they
> have them.  Tim mentioned in the patch that Python "systematically
> sets module-global bindings to None".  So I assume this means that
> referencing *any* globals during shutdown just doesn't work since it
> might be None (which makes sense in the case of this bug report).  Is
> there any specific order to this teardown?  I remember Tim saying that
> in __del__ methods you had to have locally bound anything you needed
> to call since otherwise it could be gone when you need it.

Prior to Python 2.3, gc.collect() was not called by the shutdown
process, so fewer objects got cleaned up.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra