Commit 40370fbb authored by Robert Bradshaw's avatar Robert Bradshaw

Fix leak in try-break.

parent 0a677a76
...@@ -73,8 +73,8 @@ class FunctionState(object): ...@@ -73,8 +73,8 @@ class FunctionState(object):
def new_loop_labels(self): def new_loop_labels(self):
old_labels = self.get_loop_labels() old_labels = self.get_loop_labels()
self.set_loop_labels( self.set_loop_labels(
(self.new_label(), (self.new_label("continue"),
self.new_label())) self.new_label("break")))
return old_labels return old_labels
def get_all_labels(self): def get_all_labels(self):
......
...@@ -4221,11 +4221,20 @@ class ExceptClauseNode(Node): ...@@ -4221,11 +4221,20 @@ class ExceptClauseNode(Node):
old_exc_vars = code.funcstate.exc_vars old_exc_vars = code.funcstate.exc_vars
code.funcstate.exc_vars = self.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) self.body.generate_execution_code(code)
code.funcstate.exc_vars = old_exc_vars code.funcstate.exc_vars = old_exc_vars
for var in self.exc_vars: for var in self.exc_vars:
code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var)) code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var))
code.put_goto(end_label) 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( code.putln(
"}") "}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment