De-allocate function temp variables _after_ computing return value, in case an except...
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 27 Jan 2007 07:06:06 +0000 (23:06 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 27 Jan 2007 07:06:06 +0000 (23:06 -0800)
Cython/Compiler/Nodes.py

index bb0e8277f45f22475f75f715aeeca685de7f3184..cfcb56be9c7104dcb6a680f6f1b8614a03058930 100644 (file)
@@ -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)