diff options
Diffstat (limited to 'Cython/Compiler/Symtab.py')
-rw-r--r-- | Cython/Compiler/Symtab.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index c92117d8e..5ca22ca86 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -2094,9 +2094,11 @@ class GeneratorExpressionScope(ClosureScope): class StructOrUnionScope(Scope): # Namespace of a C struct or union. + # visibility string Visibility of a C struct or union - def __init__(self, name="?"): + def __init__(self, name="?", visibility='private'): Scope.__init__(self, name, None, None) + self.visibility = visibility def declare_var(self, name, type, pos, cname=None, visibility='private', @@ -2123,8 +2125,8 @@ class StructOrUnionScope(Scope): elif type.needs_refcounting: if not allow_refcounted: error(pos, "C struct/union member cannot be reference-counted type '%s'" % type) - if visibility != 'private': - error(pos, "C struct/union member cannot be declared %s" % visibility) + if visibility != self.visibility: + error(pos, "C struct/union visibility %s does not match the member visibility %s" % (self.visibility, visibility)) return entry def declare_cfunction(self, name, type, pos, |