Python sourcecode analysis-part1

Hi Everyone ,too long time i haven't update my blog.:).From this one,i will use english  purly.if there any syntax error,please tell me.

============================================================


PyObject_VAR_HEAD--->1.PyObject_HEAD 2.Ob_size(Py_ssize)
 PyObject_HEAD ->    _PyObject_HEAD_EXTRA                \
                     Py_ssize_t ob_refcnt;               \
                     struct _typeobject *ob_type;

                     typedef struct _typeobject {
                                 PyObject_VAR_HEAD
                                 char *tp_name; /* For printing, in format "<module>.<name>" */
                                 int tp_basicsize, tp_itemsize; /* For allocation */

                                 /* Methods to implement standard operations */

                                 destructor tp_dealloc;
                                 printfunc tp_print;
                                 getattrfunc tp_getattr;
                                 setattrfunc tp_setattr;
                                 cmpfunc tp_compare;
                                 reprfunc tp_repr;

    /* Method suites for standard classes */

                               PyNumberMethods *tp_as_number;
                                PySequenceMethods *tp_as_sequence;
                                PyMappingMethods *tp_as_mapping;

                                /* More standard operations (here for binary compatibility) */

                                hashfunc tp_hash;
                                ternaryfunc tp_call;
                                reprfunc tp_str;
                                getattrofunc tp_getattro;
                                setattrofunc tp_setattro;

                                /* Functions to access object as input/output buffer */
                                PyBufferProcs *tp_as_buffer;

                                /* Flags to define presence of optional/expanded features */
                                long tp_flags;

                                char *tp_doc; /* Documentation string */

                                /* Assigned meaning in release 2.0 */
                                /* call function for all accessible objects */
                                traverseproc tp_traverse;

                                /* delete references to contained objects */
                                inquiry tp_clear;

                                /* Assigned meaning in release 2.1 */
                                /* rich comparisons */
                                richcmpfunc tp_richcompare;

                                /* weak reference enabler */
                                long tp_weaklistoffset;

                                /* Added in release 2.2 */
                                /* Iterators */
                                getiterfunc tp_iter;
                                iternextfunc tp_iternext;

                                /* Attribute descriptor and subclassing stuff */
                                struct PyMethodDef *tp_methods;
                                struct PyMemberDef *tp_members;
                                struct PyGetSetDef *tp_getset;
                                struct _typeobject *tp_base;
                                PyObject *tp_dict;
                                descrgetfunc tp_descr_get;
                                descrsetfunc tp_descr_set;
                                long tp_dictoffset;
                                initproc tp_init;
                                allocfunc tp_alloc;
                                newfunc tp_new;
                                freefunc tp_free; /* Low-level free-memory routine */
                                inquiry tp_is_gc; /* For PyObject_IS_GC */
                                PyObject *tp_bases;
                                PyObject *tp_mro; /* method resolution order */
                                PyObject *tp_cache;
                                PyObject *tp_subclasses;
                                PyObject *tp_weaklist;
                                PyObject *tp_weaklist;
                                } PyTypeObject;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值