Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: cppyy-dev Changeset: r98048:65d87222eef1 Date: 2019-11-13 09:49 -0800 http://bitbucket.org/pypy/pypy/changeset/65d87222eef1/
Log: extend support of templated methods diff --git a/pypy/module/_cppyy/interp_cppyy.py b/pypy/module/_cppyy/interp_cppyy.py --- a/pypy/module/_cppyy/interp_cppyy.py +++ b/pypy/module/_cppyy/interp_cppyy.py @@ -1355,6 +1355,8 @@ def _build_overloads(self): assert len(self.overloads) == 0 methods_tmp = {}; ftype_tmp = {} + + # add all ordinary methods (incl. pre-instantiated templates) for idx in range(capi.c_num_methods(self.space, self)): cppmeth = capi.c_get_method(self.space, self, idx) if capi.c_is_constructor(self.space, cppmeth): @@ -1372,6 +1374,7 @@ ftype_tmp[pyname] |= self._make_cppfunction(pyname, cppmeth, methods) if capi.c_method_is_template(self.space, self, idx): ftype_tmp[pyname] |= FUNCTION_IS_TEMPLATE + # the following covers the case where the only kind of operator[](idx) # returns are the ones that produce non-const references; these can be # used for __getitem__ just as much as for __setitem__, though @@ -1407,6 +1410,11 @@ overload = W_CPPOverload(self.space, self, methods[:]) self.overloads[pyname] = overload + # add placeholders for all non-instantiated templated methods + for idx in range(capi.c_get_num_templated_methods(self.space, self)): + cppname = capi.c_get_templated_method_name(self.space, self, idx) + self.overloads[cppname] = W_CPPTemplateOverload(self.space, cppname, None, self, []) + def _make_cppfunction(self, pyname, cppmeth, funcs): num_args = capi.c_method_num_args(self.space, cppmeth) args_required = capi.c_method_req_args(self.space, cppmeth) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit