cython-devel

changeset 1779:fb81e893dc8e

Fix leak in try-break.
author Robert Bradshaw <robertwb@math.washington.edu>
date Wed Feb 25 23:44:24 2009 -0800 (2 years ago)
parents a9b9b6e52360
children d2d71289fa0c
files Cython/Compiler/Code.py Cython/Compiler/Nodes.py
line diff
1.1 --- a/Cython/Compiler/Code.py Wed Feb 25 21:53:51 2009 -0800 1.2 +++ b/Cython/Compiler/Code.py Wed Feb 25 23:44:24 2009 -0800 1.3 @@ -73,8 +73,8 @@ 1.4 def new_loop_labels(self): 1.5 old_labels = self.get_loop_labels() 1.6 self.set_loop_labels( 1.7 - (self.new_label(), 1.8 - self.new_label())) 1.9 + (self.new_label("continue"), 1.10 + self.new_label("break"))) 1.11 return old_labels 1.12 1.13 def get_all_labels(self):
2.1 --- a/Cython/Compiler/Nodes.py Wed Feb 25 21:53:51 2009 -0800 2.2 +++ b/Cython/Compiler/Nodes.py Wed Feb 25 23:44:24 2009 -0800 2.3 @@ -4221,11 +4221,20 @@ 2.4 2.5 old_exc_vars = code.funcstate.exc_vars 2.6 code.funcstate.exc_vars = self.exc_vars 2.7 + old_break_label = code.break_label 2.8 + code.break_label = code.new_label('except_break') 2.9 self.body.generate_execution_code(code) 2.10 code.funcstate.exc_vars = old_exc_vars 2.11 for var in self.exc_vars: 2.12 code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var)) 2.13 code.put_goto(end_label) 2.14 + 2.15 + if code.label_used(code.break_label): 2.16 + code.put_label(code.break_label) 2.17 + for var in self.exc_vars: 2.18 + code.putln("__Pyx_DECREF(%s); %s = 0;" % (var, var)) 2.19 + code.put_goto(old_break_label) 2.20 + code.break_label = old_break_label 2.21 code.putln( 2.22 "}") 2.23