PyTypeObject의 PyMethodDef 구조체 및 PyMemberDef 구조체

2406 단어 object
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 Fabric 소스 코드(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;

 
 

좋은 웹페이지 즐겨찾기