Commit 198906bd authored by Stefan Behnel's avatar Stefan Behnel

fix a case where C array coercion helper code could be duplicated in the C file

parent 153a2217
......@@ -2247,6 +2247,9 @@ class CArrayType(CPointerBaseType):
else:
return None
def can_coerce_to_pyobject(self, env):
return self.base_type.can_coerce_to_pyobject(env)
def create_to_py_utility_code(self, env):
if self.to_py_function is not None:
return self.to_py_function
......
......@@ -1893,11 +1893,9 @@ class CClassScope(ClassScope):
if name == "__weakref__":
error(pos, "Special attribute __weakref__ cannot be exposed to Python")
if not type.is_pyobject:
if (not type.create_to_py_utility_code(self) or
(visibility=='public' and not
type.create_from_py_utility_code(self))):
error(pos,
"C attribute of type '%s' cannot be accessed from Python" % type)
if (not type.can_coerce_to_pyobject(self) or
(visibility == 'public' and not type.can_coerce_to_pyobject(self))):
error(pos, "C attribute of type '%s' cannot be accessed from Python" % type)
else:
entry.needs_property = False
return entry
......
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