In article <873aa5m6ae....@vostro.rath.org>,
Nikolaus Rath  <nikol...@rath.org> wrote:
>
>I think I managed to narrow down the problem a bit. It seems that when
>a function returns normally, its local variables are immediately
>destroyed. However, if the function is left due to an exception, the
>local variables remain alive:

Correct.  You need to get rid of the stack trace somehow; the simplest
way is to wrap things in layers of functions (i.e. return from the
function with try/except and *don't* save the traceback).  Note that if
your goal is to ensure finalization rather than recovering memory, you
need to do that explicitly rather than relying on garbage collection.
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to