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