From: Robert Bradshaw Date: Sat, 27 Jan 2007 07:06:06 +0000 (-0800) Subject: De-allocate function temp variables _after_ computing return value, in case an except... X-Git-Tag: 0.9.6.14~29^2~199 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ca53faeb24fe747ec47c521491336fded608d859;p=cython.git De-allocate function temp variables _after_ computing return value, in case an exception is thrown, caught, and said temp variables still need to be accessed. --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index bb0e8277..cfcb56be 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2933,8 +2933,6 @@ class ReturnStatNode(StatNode): if not self.return_type: # error reported earlier return - for entry in self.temps_in_use: - code.put_var_decref_clear(entry) if self.value: self.value.generate_evaluation_code(code) self.value.make_owned_reference(code) @@ -2951,6 +2949,8 @@ class ReturnStatNode(StatNode): "%s = %s;" % ( Naming.retval_cname, self.return_type.default_value)) + for entry in self.temps_in_use: + code.put_var_decref_clear(entry) code.putln( "goto %s;" % code.return_label)