summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2023-05-04 08:51:47 +0200
committerStefan Behnel <stefan_ml@behnel.de>2023-05-04 08:51:47 +0200
commitfd3b9bbaf3a8e4c83dd18a4ce099607b38d66933 (patch)
tree160c4b22acdaa4187542e47722978fd7cb454cbb
parentdee8906fe77cb27ce35b835f1b2dc0093ad92cb3 (diff)
downloadcython-fd3b9bbaf3a8e4c83dd18a4ce099607b38d66933.tar.gz
Remove the useless check that the struct field visibility is the same as the struct's visibility. This is assured by syntax.
See https://github.com/cython/cython/pull/5386
-rw-r--r--Cython/Compiler/Nodes.py2
-rw-r--r--Cython/Compiler/Symtab.py8
2 files changed, 3 insertions, 7 deletions
diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 8667e5c74..877e7b928 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -1557,7 +1557,7 @@ class CStructOrUnionDefNode(StatNode):
def analyse_declarations(self, env):
scope = None
if self.attributes is not None:
- scope = StructOrUnionScope(self.name, self.visibility)
+ scope = StructOrUnionScope(self.name)
self.declare(env, scope)
if self.attributes is not None:
if self.in_pxd and not env.in_cinclude:
diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py
index 5ca22ca86..608d68c22 100644
--- a/Cython/Compiler/Symtab.py
+++ b/Cython/Compiler/Symtab.py
@@ -2094,11 +2094,9 @@ 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="?", visibility='private'):
- Scope.__init__(self, name, None, None)
- self.visibility = visibility
+ def __init__(self, name="?"):
+ Scope.__init__(self, name, outer_scope=None, parent_scope=None)
def declare_var(self, name, type, pos,
cname=None, visibility='private',
@@ -2125,8 +2123,6 @@ 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 != 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,