Message377714
I am trying to create app embedded python as interpreter, and I use PyImport_AppendInittab to import some helper functions to python. on website the example is excellent when you already know how many functions we want to import. but when my functions are based on a runtime dynamic list, even I create all PyModuleDef and PyMethodDef, but when the function all goes to PyCFunction which only has two PyObject* and return PyObject* i lost context information about C. may be I am not clear, but what I am expecting is PyMethodDef should define like
struct PyMethodDef {
const char *ml_name; /* The name of the built-in function/method */
PyCFunction ml_meth; /* The C function that implements it */
int ml_flags; /* Combination of METH_xxx flags, which mostly
describe the args expected by the C func */
const char *ml_doc; /* The __doc__ attribute, or NULL */
void* extra; /* <================= here is NEW */
};
and PyCFunction should define like
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *, void * /* for extra void* */); |
|
Date |
User |
Action |
Args |
2020-09-30 17:38:05 | dexter | set | recipients:
+ dexter |
2020-09-30 17:38:05 | dexter | set | messageid: <1601487485.79.0.674367935184.issue41895@roundup.psfhosted.org> |
2020-09-30 17:38:05 | dexter | link | issue41895 messages |
2020-09-30 17:38:05 | dexter | create | |
|