On Wed, Feb 13, 2013 at 9:40 PM, Antoine Pitrou
On Wed, 13 Feb 2013 20:30:18 +0100 Armin Rigo
wrote: Hi,
On Wed, Feb 13, 2013 at 8:22 PM, Maciej Fijalkowski
wrote: I think it's well documented you should not rely on stuff like that being run at the exit of the interpreter.
Actually right now, at the exit of the interpreter, we just leave the program without caring about running any __del__. This might mean that in a short-running script no __del__ is ever run. I'd add this question to your original list: is it good enough, or should we try harder to run destructors at the exit?
Destructors should be run at exit like they would be in any other finalization situation. Anything else is dangerous, since important resources may not be finalized, committed, or released.
(and by destructors I also mean weakref callbacks)
Regards
Antoine.
I think Antoine is right (despite the fact that CPython docs clearly state that __del__s might not be run on the interpreter exit actually) Cheers, fijal