1.PyMethodDef结构体源码(Include/methodobject.h):
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); 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 */ }; typedef struct PyMethodDef PyMethodDef;
2.PyMemberDef结构体源码(Include/structmember.h):
/* An array of PyMemberDef structures defines the name, type and offset of selected members of a C structure. These can be read by PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY flag is set). The array must be terminated with an entry whose name pointer is NULL. */ typedef struct PyMemberDef { char *name; int type; Py_ssize_t offset; int flags; char *doc; } PyMemberDef;