This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dexter
Recipients dexter
Date 2020-09-30.17:38:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601487485.79.0.674367935184.issue41895@roundup.psfhosted.org>
In-reply-to
Content
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* */);
History
Date User Action Args
2020-09-30 17:38:05dextersetrecipients: + dexter
2020-09-30 17:38:05dextersetmessageid: <1601487485.79.0.674367935184.issue41895@roundup.psfhosted.org>
2020-09-30 17:38:05dexterlinkissue41895 messages
2020-09-30 17:38:05dextercreate