new temps bug on indexing deletion
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sat, 21 Feb 2009 15:58:14 +0000 (16:58 +0100)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sat, 21 Feb 2009 15:58:14 +0000 (16:58 +0100)
Cython/Compiler/ExprNodes.py
tests/run/delete.pyx [new file with mode: 0644]

index 47f265ec4ac5f57fa86e4f47ce5ffd41db03fb24..8ab9019eec355a1720a3c254e46fc11874570969 100644 (file)
@@ -1925,6 +1925,7 @@ class IndexNode(ExprNode):
                 self.index_unsigned_parameter(),
                 code.error_goto(self.pos)))
         self.generate_subexpr_disposal_code(code)
+        self.free_subexpr_temps(code)
 
     def buffer_lookup_code(self, code):
         # Assign indices to temps
diff --git a/tests/run/delete.pyx b/tests/run/delete.pyx
new file mode 100644 (file)
index 0000000..b6cc2c0
--- /dev/null
@@ -0,0 +1,18 @@
+"""
+>>> a = A()
+>>> a.f()
+[2, 1]
+>>> a.g()
+(False, True)
+"""
+
+class A:
+    def f(self):
+        self.refs = [3,2,1]
+        del self.refs[0]
+        return self.refs
+
+    def g(self):
+        self.a = 3
+        del self.a
+        return (hasattr(self, "a"), hasattr(self, "g"))