(common object structure)
Python
Python
PyObject PyVarObject
Python
-
PyVarObject_HEAD_INIT(type, size) ob_sizePyVarObject_PyObject_EXTRA_INIT 1, type, size,
-
PyCFunction Python C 2
PyObject*PyObject* NULL NULL Python
-
PyCFunctionWithKeywords Python C : 3
PyObject*PyObject*PyCFunction
ml_meth C PyObject* PyFunction PyCFunction PyObject* C self
ml_flags
(calling convention) (binding convention)
METH_VARARGS METH_KEYWORDS
-
METH_VARARGS PyCFunctionPyObject*self ; ( args )PyArg_ParseTuple()PyArg_UnpackTuple()
-
METH_KEYWORDS PyCFunctionWithKeywords3 : self argsMETH_VARARGSPyArg_ParseTupleAndKeywords()
-
METH_NOARGS METH_NOARGSPyCFunctionself NULL
-
METH_O PyArg_ParseTuple()"O"METH_OPyCFunctionselfPyObject*
-
METH_CLASS classmethod()(class method)
-
METH_STATIC NULL
staticmethod()(static method)
-
METH_COEXIST METH_COEXIST sq_contains
__contains__()PyCFunction PyCFunction PyCFunctions
-
PyMemberDef type C :
C namechar * typeint C offsetPy_ssize_t type object offset flagsint docchar * docstring typeCT_1 Python PythonC T_SHORT short T_INT int T_LONG long T_FLOAT T_DOUBLE double T_STRING char * T_OBJECT PyObject * T_OBJECT_EX PyObject * T_CHAR char T_BYTE char T_UBYTE unsigned char T_UINT unsigned int T_USHORT unsigned short T_ULONG unsigned long T_BOOL char T_LONGLONG long long T_ULONGLONG unsigned long long T_PYSSIZET Py_ssize_t T_OBJECTT_OBJECT_EXT_OBJECTNULLNoneT_OBJECT_EXAttributeErrorT_OBJECT_EXT_OBJECTdelT_OBJECTT_OBJECT_EXflags0READONLYtypeT_STRINGREADONLYT_OBJECTT_OBJECT_EX(NULL )
-
PyGetSetDef Structure to define property-like access for a type. See also description of the
PyTypeObject.tp_getsetslot.C char * attribute name get getter C Function to get the attribute setter optional C function to set or delete the attribute, if omitted the attribute is readonly doc char * optional docstring closure void * optional function pointer, providing additional data for getter and setter The
getfunction takes onePyObject*parameter (the instance) and a function pointer (the associatedclosure):typedef PyObject *(*getter)(PyObject *, void *);
It should return a new reference on success or NULL with a set exception on failure.
setfunctions take twoPyObject*parameters (the instance and the value to be set) and a function pointer (the associatedclosure):typedef int (*setter)(PyObject *, PyObject *, void *);
In case the attribute should be deleted the second parameter is NULL. Should return
0on success or-1with a set exception on failure.