I have a module written using the Python C API:
static PyObject* my_func1(PyObject* /*self*/, PyObject* args)
{
Py_RETURN_NONE;
}
static PyObject* my_func2(PyObject* /*self*/, PyObject* args)
{
Py_RETURN_NONE;
}
static PyMethodDef methods[] = {
{"my_func1", (PyCFunction)my_func1, METH_VARARGS, ""},
{"my_func2", (PyCFunction)my_func2, METH_VARARGS, ""},
{NULL, NULL, 0, NULL} /* sentinel */
};
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT, my_module, NULL, -1, methods, NULL, NULL, NULL, NULL
};
PyMODINIT_FUNC PyInit_my_module(void){
return PyModule_Create(&moduledef);
}
as one of the arguments a user can pass a function e.g.:
my_func1(my_func2)
How can I detect inside my_func1
, that the argument the user passed is a function, that points to my_func2
using the Python C API?