del test and assignment fix
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 18 Feb 2011 21:39:37 +0000 (13:39 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 18 Feb 2011 21:39:37 +0000 (13:39 -0800)
Cython/Compiler/TypeInference.py
tests/errors/e_del2.pyx [deleted file]
tests/run/delete.pyx

index 857a28b0cfb8b31f22ae6c4207a332b8d70c1f5a..c788d02c3897a515dd62adbc70cc733d6758c95a 100644 (file)
@@ -121,6 +121,12 @@ class MarkAssignments(CythonTransform):
         self.visitchildren(node)
         return node
 
+    def visit_DelStatNode(self, node):
+        for arg in node.args:
+            self.mark_assignment(arg, arg)
+        self.visitchildren(node)
+        return node
+
 class MarkOverflowingArithmetic(CythonTransform):
 
     # It may be possible to integrate this with the above for
diff --git a/tests/errors/e_del2.pyx b/tests/errors/e_del2.pyx
deleted file mode 100644 (file)
index 20dac71..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Errors reported during code generation.
-
-cdef int i
-
-def f(a):
-       del a # error: deletion of local name not supported
-       del i # error: deletion of local name not supported
-
-_ERRORS = u"""
-6:52: Deletion of local or C global name not supported
-7:52: Deletion of local or C global name not supported
-"""
index 2aabbf425cf8f7cab475d1b30892d54904b8e93a..7157078a0ba3b99f92162457d1ad1db275d5efd8 100644 (file)
@@ -80,3 +80,10 @@ def del_temp_slice(a):
     while a.attr:
         del a.attr[:]
     return a.attr
+
+def del_local(a):
+    """
+    >>> del_local(object())
+    """
+    del a
+    assert a is None # Until we have unbound locals...