Commit 021d6ab8 authored by Xavier Thompson's avatar Xavier Thompson

Avoid wrapping cypclass methods with Python-incompatible argument types

parent 395782ae
......@@ -1647,7 +1647,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
cfunc_declarator = cfunc_method.cfunc_declarator
# C++ methods have an implict 'this', so the 'self' argument is skipped in the declarator
# > c++ methods have an implict 'this', so the 'self' argument is skipped in the declarator
skipped_self = cfunc_declarator.skipped_self
if not skipped_self:
return # if this ever happens (?), skip non-static methods without a self argument
......@@ -1655,10 +1655,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
cfunc_type = cfunc_method.type
cfunc_return_type = cfunc_type.return_type
# > TODO: the Python-incompatibility is too conservative:
# some types have not yet resolved that they can coerce to PyObject
# in particular, any cypclass not yet examined ?
# we pass the global scope as argument, should not affect the result (?)
if not cfunc_return_type.can_coerce_to_pyobject(env.global_scope()):
return # skip c methods with Python-incompatible return types
for argtype in cfunc_type.args:
if not argtype.type.can_coerce_to_pyobject(env.global_scope()):
return # skip c methods with Python-incompatible argument types
from .CypclassWrapper import underlying_name
from . import ExprNodes
......
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