'C Python How to create a function inside another function as a decorator using C

I would like to know how to create a Python function inside another Python function using C? Try something like this:

static PyObject *func(PyObject *self, PyObject *wrap) { // METH_O
       PyObject *newfunc(PyObject *self, PyObject *args, PyObject *kwds) = { return PyObject_Call(wrap, args, kwds); }
       return newfunc;
}

But the compiler expects another expression. I would like to know (or some clues) to advance my project, How to create a function inside another python function using C?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source