fix #684: del in Python class scope
authorStefan Behnel <scoder@users.berlios.de>
Wed, 13 Apr 2011 20:27:13 +0000 (22:27 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 13 Apr 2011 20:27:13 +0000 (22:27 +0200)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Symtab.py
tests/bugs.txt

index 4a4d41ce7beb3091455d7df0701bcfd77e1f2b16..ef2911e6812a6aa545205fdbb613e38a7753d83f 100755 (executable)
@@ -1682,17 +1682,17 @@ class NameNode(AtomicExprNode):
     def generate_deletion_code(self, code):
         if self.entry is None:
             return # There was an error earlier
-        elif self.entry.is_pyglobal:
-            code.put_error_if_neg(self.pos,
-                '__Pyx_DelAttrString(%s, "%s")' % (
-                    Naming.module_cname,
-                    self.entry.name))
         elif self.entry.is_pyclass_attr:
             namespace = self.entry.scope.namespace_cname
             code.put_error_if_neg(self.pos,
                 'PyMapping_DelItemString(%s, "%s")' % (
                     namespace,
                     self.entry.name))
+        elif self.entry.is_pyglobal:
+            code.put_error_if_neg(self.pos,
+                '__Pyx_DelAttrString(%s, "%s")' % (
+                    Naming.module_cname,
+                    self.entry.name))
         elif self.entry.type.is_pyobject:
             # Fake it until we can do it for real...
             self.generate_assignment_code(NoneNode(self.pos), code)
index 8a7e7e6ca6632cf2d8b5bf5dec687b4d7dd2884c..f86bb164bbc1f7440c6006625ea2c14dd7547b7f 100644 (file)
@@ -1490,7 +1490,7 @@ class PyClassScope(ClassScope):
         # Add an entry for a class attribute.
         entry = Scope.declare_var(self, name, type, pos,
                                   cname=cname, visibility=visibility, api=api, is_cdef=is_cdef)
-        entry.is_pyglobal = 1
+        entry.is_pyglobal = 1 # FIXME: WTF?
         entry.is_pyclass_attr = 1
         return entry
 
index 7e844b860364193d757969d69c3c0856335c413d..2aa611e0b99fe1bdc571e93b19d53670675f6997 100644 (file)
@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601
 decorators_T593
 temp_sideeffects_T654
 class_scope_T671
-class_scope_del_T684
 
 # CPython regression tests that don't current work:
 pyregr.test_threadsignals