Does Python cache the startup module?

Baz Walter bazwal at
Mon Jan 7 22:16:43 CET 2008

Fredrik Lundh <fredrik <at>> writes:
> So what you're concerned about is the lack of cleanup during interpreter 
> shutdown, not a true leak (which would result in "Max widgets" growing 
> towards infinity).

Yes, sorry about my sloppy terminology.

> The problem here is that you're relying on Python's GC to remove things 
> in a given order during shutdown, something that may or may not happen
> depending on lots of things that you cannot control:
> (Note the repeated use of "In an order determined by the dictionary 
> hashing of the names" in that article.)
> The only way to get *predictable* shutdown behaviour in situations like 
> this is to clean things up yourself.  But in this case, you might as 
> well leave the cleanup to the OS.

I think you've found the real cause. I changed the name from 'mainwidget' 
to 'aaa' and the problem went away. I will have to investigate whether there is 
anything I can do from the Qt side to make sure things get cleaned up more 

Many Thanks

More information about the Python-list mailing list