Commit 00b26e0b authored by Xavier Thompson's avatar Xavier Thompson

Wrap cypclass methods only when all args can be converted *from* python

parent b7135b9f
......@@ -378,7 +378,7 @@ class CypclassWrapperInjection(Visitor.CythonTransform):
return # skip c methods with Python-incompatible return types
for argtype in cfunc_type.args:
if not argtype.type.can_coerce_to_pyobject(self.module_scope):
if not argtype.type.can_coerce_from_pyobject(self.module_scope):
return # skip c methods with Python-incompatible argument types
# > name of the wrapping method: same name as in the original code
......
......@@ -4241,6 +4241,10 @@ class CypClassType(CppClassType):
def can_coerce_to_pyobject(self, env):
return self.wrapper_type is not None
# allow conversion from Python only when there is a wrapper type
def can_coerce_from_pyobject(self, env):
return self.wrapper_type is not None
def create_to_py_utility_code(self, env):
if not self.wrapper_type:
return False
......
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