call of __del__ non-deterministic in python 2.4 (cpython)?

Anthony Baxter anthonybaxter at gmail.com
Wed Dec 13 07:48:01 EST 2006


On 12/13/06, Holger Joukl <Holger.Joukl at lbbw.de> wrote:
> I did read this but didn't think it applied to my situation. I'm quite
> sure that the refcount of the local variable is 1 before the local scope
> is left.
> So let me rephrase the question: Even if I can make sure that non of the
> problematic situtions apply, might it _still_ happen that __del__ gets
> called
> after some other code has already been "entered"?

You shouldn't rely on __del__ being called exactly when you expect it,
particularly in a threaded application. Make explicit cleanup calls,
instead.



More information about the Python-list mailing list