Commit e46c93f1 authored by Robert Bradshaw's avatar Robert Bradshaw

Emulate del with set to None.

parent 2651a5d4
...@@ -1674,20 +1674,22 @@ class NameNode(AtomicExprNode): ...@@ -1674,20 +1674,22 @@ 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
if not self.entry.is_pyglobal: elif self.entry.is_pyglobal:
error(self.pos, "Deletion of local or C global name not supported") code.put_error_if_neg(self.pos,
return '__Pyx_DelAttrString(%s, "%s")' % (
if self.entry.is_pyclass_attr: Naming.module_cname,
self.entry.name))
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.type.is_pyobject:
# Fake it until we can do it for real...
self.generate_assignment_code(NoneNode(self.pos), code)
else: else:
code.put_error_if_neg(self.pos, error(self.pos, "Deletion of C names not supported")
'__Pyx_DelAttrString(%s, "%s")' % (
Naming.module_cname,
self.entry.name))
def annotate(self, code): def annotate(self, code):
if hasattr(self, 'is_called') and self.is_called: if hasattr(self, 'is_called') and self.is_called:
......
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