From 69cd1c34279d660ad113bb23fcde144cc31a09df Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 13 Apr 2011 22:27:13 +0200 Subject: [PATCH] fix #684: del in Python class scope --- Cython/Compiler/ExprNodes.py | 10 +++++----- Cython/Compiler/Symtab.py | 2 +- tests/bugs.txt | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 4a4d41ce..ef2911e6 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 8a7e7e6c..f86bb164 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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 diff --git a/tests/bugs.txt b/tests/bugs.txt index 7e844b86..2aa611e0 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -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 -- 2.26.2