From 0278a753b4f6ec71b6abcd92f88690d512fdc380 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 9 Dec 2010 16:57:07 +0100 Subject: [PATCH] fix local variable init code in ScopedExprNode --- Cython/Compiler/ExprNodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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()) -- 2.26.2