Fix for new temps and inplace ops
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 15 Jan 2009 09:46:28 +0000 (01:46 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 15 Jan 2009 09:46:28 +0000 (01:46 -0800)
Cython/Compiler/Nodes.py

index dbbe176647862d286830ee0e73cb1e96c41ae375..d2cf0b5193c99556bbe6e37e5f62a7f978dc53c0 100644 (file)
@@ -3045,14 +3045,18 @@ class InPlaceAssignmentNode(AssignmentNode):
             self.result_value.release_temp(env)
 
     def generate_execution_code(self, code):
+        import ExprNodes
         self.rhs.generate_evaluation_code(code)
         self.dup.generate_subexpr_evaluation_code(code)
+        if isinstance(self.dup, ExprNodes.NewTempExprNode):
+            # This is because we're manually messing with subexpr nodes
+            if self.dup.is_temp:
+                self.dup.allocate_temp_result(code)
         # self.dup.generate_result_code is run only if it is not buffer access
         if self.operator == "**":
             extra = ", Py_None"
         else:
             extra = ""
-        import ExprNodes
         if self.lhs.type.is_pyobject:
             if isinstance(self.lhs, ExprNodes.IndexNode) and self.lhs.is_buffer_access:
                 error(self.pos, "In-place operators not allowed on object buffers in this release.")