Commit 69cd1c34 authored by Stefan Behnel's avatar Stefan Behnel

fix #684: del in Python class scope

parent 38aca14c
...@@ -1682,17 +1682,17 @@ class NameNode(AtomicExprNode): ...@@ -1682,17 +1682,17 @@ class NameNode(AtomicExprNode):
def generate_deletion_code(self, code): def generate_deletion_code(self, code):
if self.entry is None: if self.entry is None:
return # There was an error earlier 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: elif self.entry.is_pyclass_attr:
namespace = self.entry.scope.namespace_cname namespace = self.entry.scope.namespace_cname
code.put_error_if_neg(self.pos, code.put_error_if_neg(self.pos,
'PyMapping_DelItemString(%s, "%s")' % ( 'PyMapping_DelItemString(%s, "%s")' % (
namespace, namespace,
self.entry.name)) 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: elif self.entry.type.is_pyobject:
# Fake it until we can do it for real... # Fake it until we can do it for real...
self.generate_assignment_code(NoneNode(self.pos), code) self.generate_assignment_code(NoneNode(self.pos), code)
......
...@@ -1490,7 +1490,7 @@ class PyClassScope(ClassScope): ...@@ -1490,7 +1490,7 @@ class PyClassScope(ClassScope):
# Add an entry for a class attribute. # Add an entry for a class attribute.
entry = Scope.declare_var(self, name, type, pos, entry = Scope.declare_var(self, name, type, pos,
cname=cname, visibility=visibility, api=api, is_cdef=is_cdef) 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 entry.is_pyclass_attr = 1
return entry return entry
......
...@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601 ...@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601
decorators_T593 decorators_T593
temp_sideeffects_T654 temp_sideeffects_T654
class_scope_T671 class_scope_T671
class_scope_del_T684
# CPython regression tests that don't current work: # CPython regression tests that don't current work:
pyregr.test_threadsignals pyregr.test_threadsignals
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment