Merge of refcount bugfix
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 25 Jul 2008 10:17:21 +0000 (12:17 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 25 Jul 2008 10:17:21 +0000 (12:17 +0200)
1  2 
Cython/Compiler/ExprNodes.py

index fef53037c2ce26f0761b928d355b65818113d4b5,b0c98c66b7d7de89b88564c0f7221ad09d13807d..cf8f0d6b211732b5d25c3420f4370afa87a2bcfd
@@@ -1049,19 -1037,16 +1050,19 @@@ class NameNode(AtomicExprNode)
                  #print "...from", rhs ###
                  #print "...LHS type", self.type, "ctype", self.ctype() ###
                  #print "...RHS type", rhs.type, "ctype", rhs.ctype() ###
-                 rhs.make_owned_reference(code)
-                 if entry.is_local and not Options.init_local_none:
-                     initalized = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
-                     if initalized is True:
+                 if not self.skip_assignment_decref:
+                     if entry.is_local and not Options.init_local_none:
+                         initalized = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
+                         if initalized is True:
+                             code.put_decref(self.result_code, self.ctype())
+                         elif initalized is None:
+                             code.put_xdecref(self.result_code, self.ctype())
+                     else:
                          code.put_decref(self.result_code, self.ctype())
-                     elif initalized is None:
-                         code.put_xdecref(self.result_code, self.ctype())
-                 else:
-                     code.put_decref(self.result_code, self.ctype())
 -            code.putln('%s = %s;' % (self.result_code, rhs.result_as(self.ctype())))
 +            if self.type.is_buffer:
 +                self.generate_acquire_buffer(rhs, code)
 +            else:
 +                code.putln('%s = %s;' % (self.result_code, rhs.result_as(self.ctype())))
              if debug_disposal_code:
                  print("NameNode.generate_assignment_code:")
                  print("...generating post-assignment code for %s" % rhs)