From: Robert Bradshaw Date: Thu, 26 Feb 2009 07:44:24 +0000 (-0800) Subject: Fix leak in try-break. X-Git-Tag: 0.11.rc~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=40370fbba8a0b59324c5273c5d743bf78841aadb;p=cython.git Fix leak in try-break. --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index 356736dc..cfc59bd8 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -73,8 +73,8 @@ class FunctionState(object): def new_loop_labels(self): old_labels = self.get_loop_labels() self.set_loop_labels( - (self.new_label(), - self.new_label())) + (self.new_label("continue"), + self.new_label("break"))) return old_labels def get_all_labels(self): diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index f67f3e94..27ca2bf1 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -4221,11 +4221,20 @@ class ExceptClauseNode(Node): old_exc_vars = code.funcstate.exc_vars code.funcstate.exc_vars = self.exc_vars + old_break_label = code.break_label + code.break_label = code.new_label('except_break') self.body.generate_execution_code(code) code.funcstate.exc_vars = old_exc_vars for var in self.exc_vars: code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var)) code.put_goto(end_label) + + if code.label_used(code.break_label): + code.put_label(code.break_label) + for var in self.exc_vars: + code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var)) + code.put_goto(old_break_label) + code.break_label = old_break_label code.putln( "}")