New submission from dexter <[email protected]>:
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* */);
----------
components: C API
messages: 377714
nosy: dexter
priority: normal
severity: normal
status: open
title: PyMethodDef does NOT have any field contains context in embedded C
type: enhancement
versions: Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41895>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com