@@ -58,6 +58,16 @@ class TPythonCallback : public PyCallable {
5858 virtual PyObject* GetSignature (bool /* show_formalargs*/ = true ) {
5959 return CPyCppyy_PyText_FromString (" *args, **kwargs" );
6060 }
61+
62+
63+ PyObject* GetSignatureNames () override {
64+ return PyTuple_New (0 );
65+ }
66+
67+ PyObject* GetSignatureTypes () override {
68+ return PyTuple_New (0 );
69+ }
70+
6171 virtual PyObject* GetPrototype (bool /* show_formalargs*/ = true ) {
6272 return CPyCppyy_PyText_FromString (" <callback>" );
6373 }
@@ -241,6 +251,42 @@ static PyObject* mp_doc(CPPOverload* pymeth, void*)
241251 return doc;
242252}
243253
254+ static PyObject* mp_func_overloads_types (CPPOverload* pymeth, void *)
255+ {
256+
257+ CPPOverload::Methods_t& methods = pymeth->fMethodInfo ->fMethods ;
258+
259+ CPPOverload::Methods_t::size_type nMethods = methods.size ();
260+ if (nMethods == 0 ) // from template proxy with no instantiations
261+ return nullptr ;
262+
263+ PyObject* overloads_types_dict = PyDict_New ();
264+ for (CPPOverload::Methods_t::size_type i = 0 ; i < nMethods; ++i) {
265+ PyDict_SetItem (overloads_types_dict, methods[i]->GetSignature (), methods[i]->GetSignatureTypes ());
266+ }
267+
268+ return overloads_types_dict;
269+
270+ }
271+
272+ static PyObject* mp_func_overloads_names (CPPOverload* pymeth, void *)
273+ {
274+
275+ CPPOverload::Methods_t& methods = pymeth->fMethodInfo ->fMethods ;
276+
277+ CPPOverload::Methods_t::size_type nMethods = methods.size ();
278+ if (nMethods == 0 ) // from template proxy with no instantiations
279+ return nullptr ;
280+
281+ PyObject* overloads_names_dict = PyDict_New ();
282+ for (CPPOverload::Methods_t::size_type i = 0 ; i < nMethods; ++i) {
283+ PyDict_SetItem (overloads_names_dict, methods[i]->GetSignature (), methods[i]->GetSignatureNames ());
284+ }
285+
286+ return overloads_names_dict;
287+
288+ }
289+
244290// ----------------------------------------------------------------------------
245291static PyObject* mp_meth_func (CPPOverload* pymeth, void *)
246292{
@@ -514,6 +560,8 @@ static PyGetSetDef mp_getset[] = {
514560 {(char *)" func_globals" , (getter)mp_func_globals, nullptr , nullptr , nullptr },
515561 {(char *)" func_doc" , (getter)mp_doc, nullptr , nullptr , nullptr },
516562 {(char *)" func_name" , (getter)mp_name, nullptr , nullptr , nullptr },
563+ {(char *)" func_overloads_types" , (getter)mp_func_overloads_types, nullptr , nullptr , nullptr },
564+ {(char *)" func_overloads_names" , (getter)mp_func_overloads_names, nullptr , nullptr , nullptr },
517565
518566 {(char *)" __creates__" , (getter)mp_getcreates, (setter)mp_setcreates,
519567 (char *)" For ownership rules of result: if true, objects are python-owned" , nullptr },
@@ -971,3 +1019,4 @@ CPyCppyy::CPPOverload::MethodInfo_t::~MethodInfo_t()
9711019}
9721020
9731021// TODO: something like PyMethod_Fini to clear up the free_list
1022+
0 commit comments