From: Stefan Behnel Date: Thu, 9 Dec 2010 15:57:07 +0000 (+0100) Subject: fix local variable init code in ScopedExprNode X-Git-Tag: 0.14.rc0~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0278a753b4f6ec71b6abcd92f88690d512fdc380;p=cython.git fix local variable init code in ScopedExprNode --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index d58e9823..0e89b311 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4181,12 +4181,13 @@ class ScopedExprNode(ExprNode): code.put_var_declaration(entry) if entry.type.is_pyobject and entry.used: py_entries.append(entry) - code.put_init_var_to_py_none(entry) if not py_entries: # no local Python references => no cleanup required generate_inner_evaluation_code(code) code.putln('} /* exit inner scope */') return + for entry in py_entries: + code.put_init_var_to_py_none(entry) # must free all local Python references at each exit point old_loop_labels = tuple(code.new_loop_labels())