From edc670be00bedea51b555624e4195b86334fca99 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 9 Mar 2011 18:53:55 -0500 Subject: [PATCH] Apply a few minor fixes I noticed while adjusting the minimal-visibility branch. --- Cython/Compiler/Nodes.py | 3 ++- Cython/Compiler/Symtab.py | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 9178760c..9aa81eba 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -940,7 +940,8 @@ class CVarDefNode(StatNode): # If the field is an external typedef, we cannot be sure about the type, # so do conversion ourself rather than rely on the CPython mechanism (through # a property; made in AnalyseDeclarationsTransform). - if dest_scope.is_c_class_scope and self.c_visibility == 'public': + if (dest_scope.is_c_class_scope + and self.visibility in ('public', 'readonly')): need_property = True else: need_property = False diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 2efa2041..f64b89e8 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -350,7 +350,7 @@ class Scope(object): # else: # entries[binding.name] = entry if not shadow: - entries[binding.name] = entry + entries[binding.name] = entry entry.scope = self return entry @@ -1286,8 +1286,7 @@ class ModuleScope(Scope): print("...entry %s %s" % (entry.name, entry)) print("......type = ", entry.type) print("......binding.c_visibility = ", entry.c_visibility) - print("......binding.visibility = ", - entry.python.binding.visibility) + print("......binding.visibility = ", entry.visibility) self.check_c_class(entry) def check_c_functions(self): @@ -1610,9 +1609,7 @@ class CClassScope(ClassScope): if binding.name == "__weakref__": error(pos, "Special attribute __weakref__ cannot be exposed to Python") if not type.is_pyobject: - #print 'XXX', binding.name, binding.c_visibility == 'extern', binding.c_visibility, binding.visibility, type.create_to_py_utility_code(self), type.__class__ ####### XXXXX BUG! (cimportfrom_T248) if not type.create_to_py_utility_code(self): - #print 'XXX', binding.name, binding.c_visibility == 'extern', binding.c_visibility, binding.visibility ####### XXXXX BUG! (cimportfrom_T248) error(pos, "C attribute of type '%s' cannot be accessed from Python" % type) return entry @@ -1730,7 +1727,6 @@ class CClassScope(ClassScope): entry = self.declare(binding, py_object_type, pos = pos) entry.is_property = 1 entry.doc = doc - # WTK: TODO: adjust PropertyScope attributes entry.scope = PropertyScope(binding.name, outer_scope = self.global_scope(), parent_scope = self) entry.scope.parent_type = self.parent_type -- 2.26.2