Lines Matching refs:tp
104 PyTypeObject *tp; in dump_counts() local
105 for (tp = type_list; tp; tp = tp->tp_next) in dump_counts()
109 tp->tp_name, tp->tp_allocs, tp->tp_frees, in dump_counts()
110 tp->tp_maxalloc); in dump_counts()
125 PyTypeObject *tp; in get_counts() local
132 for (tp = type_list; tp; tp = tp->tp_next) { in get_counts()
133 v = Py_BuildValue("(snnn)", tp->tp_name, tp->tp_allocs, in get_counts()
134 tp->tp_frees, tp->tp_maxalloc); in get_counts()
150 inc_count(PyTypeObject *tp) in inc_count() argument
152 if (tp->tp_next == NULL && tp->tp_prev == NULL) { in inc_count()
154 if (tp->tp_next != NULL) /* sanity check */ in inc_count()
157 type_list->tp_prev = tp; in inc_count()
158 tp->tp_next = type_list; in inc_count()
167 Py_INCREF(tp); in inc_count()
168 type_list = tp; in inc_count()
173 _Py_AddToAllObjects((PyObject *)tp, 0); in inc_count()
176 tp->tp_allocs++; in inc_count()
177 if (tp->tp_allocs - tp->tp_frees > tp->tp_maxalloc) in inc_count()
178 tp->tp_maxalloc = tp->tp_allocs - tp->tp_frees; in inc_count()
181 void dec_count(PyTypeObject *tp) in dec_count() argument
183 tp->tp_frees++; in dec_count()
185 tp->tp_allocs == tp->tp_frees) { in dec_count()
187 if (tp->tp_prev) in dec_count()
188 tp->tp_prev->tp_next = tp->tp_next; in dec_count()
190 type_list = tp->tp_next; in dec_count()
191 if (tp->tp_next) in dec_count()
192 tp->tp_next->tp_prev = tp->tp_prev; in dec_count()
193 tp->tp_next = tp->tp_prev = NULL; in dec_count()
194 Py_DECREF(tp); in dec_count()
229 PyObject_Init(PyObject *op, PyTypeObject *tp) in PyObject_Init() argument
234 Py_TYPE(op) = tp; in PyObject_Init()
240 PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size) in PyObject_InitVar() argument
246 Py_TYPE(op) = tp; in PyObject_InitVar()
252 _PyObject_New(PyTypeObject *tp) in _PyObject_New() argument
255 op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp)); in _PyObject_New()
258 return PyObject_INIT(op, tp); in _PyObject_New()
262 _PyObject_NewVar(PyTypeObject *tp, Py_ssize_t nitems) in _PyObject_NewVar() argument
265 const size_t size = _PyObject_VAR_SIZE(tp, nitems); in _PyObject_NewVar()
269 return PyObject_INIT_VAR(op, tp, nitems); in _PyObject_NewVar()
275 PyTypeObject *tp = Py_TYPE(self); in PyObject_CallFinalizer() local
279 if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_FINALIZE) || in PyObject_CallFinalizer()
280 tp->tp_finalize == NULL) in PyObject_CallFinalizer()
283 if (PyType_IS_GC(tp) && _PyGC_FINALIZED(self)) in PyObject_CallFinalizer()
286 tp->tp_finalize(self); in PyObject_CallFinalizer()
287 if (PyType_IS_GC(tp)) in PyObject_CallFinalizer()
789 PyTypeObject *tp = Py_TYPE(v); in PyObject_Hash() local
790 if (tp->tp_hash != NULL) in PyObject_Hash()
791 return (*tp->tp_hash)(v); in PyObject_Hash()
797 if (tp->tp_dict == NULL) { in PyObject_Hash()
798 if (PyType_Ready(tp) < 0) in PyObject_Hash()
800 if (tp->tp_hash != NULL) in PyObject_Hash()
801 return (*tp->tp_hash)(v); in PyObject_Hash()
903 PyTypeObject *tp = Py_TYPE(v); in PyObject_GetAttr() local
911 if (tp->tp_getattro != NULL) in PyObject_GetAttr()
912 return (*tp->tp_getattro)(v, name); in PyObject_GetAttr()
913 if (tp->tp_getattr != NULL) { in PyObject_GetAttr()
917 return (*tp->tp_getattr)(v, (char *)name_str); in PyObject_GetAttr()
921 tp->tp_name, name); in PyObject_GetAttr()
928 PyTypeObject *tp = Py_TYPE(v); in _PyObject_LookupAttr() local
938 if (tp->tp_getattro == PyObject_GenericGetAttr) { in _PyObject_LookupAttr()
948 if (tp->tp_getattro != NULL) { in _PyObject_LookupAttr()
949 *result = (*tp->tp_getattro)(v, name); in _PyObject_LookupAttr()
951 else if (tp->tp_getattr != NULL) { in _PyObject_LookupAttr()
957 *result = (*tp->tp_getattr)(v, (char *)name_str); in _PyObject_LookupAttr()
1003 PyTypeObject *tp = Py_TYPE(v); in PyObject_SetAttr() local
1015 if (tp->tp_setattro != NULL) { in PyObject_SetAttr()
1016 err = (*tp->tp_setattro)(v, name, value); in PyObject_SetAttr()
1020 if (tp->tp_setattr != NULL) { in PyObject_SetAttr()
1024 err = (*tp->tp_setattr)(v, (char *)name_str, value); in PyObject_SetAttr()
1030 if (tp->tp_getattr == NULL && tp->tp_getattro == NULL) in PyObject_SetAttr()
1034 tp->tp_name, in PyObject_SetAttr()
1041 tp->tp_name, in PyObject_SetAttr()
1053 PyTypeObject *tp = Py_TYPE(obj); in _PyObject_GetDictPtr() local
1055 dictoffset = tp->tp_dictoffset; in _PyObject_GetDictPtr()
1065 size = _PyObject_VAR_SIZE(tp, tsize); in _PyObject_GetDictPtr()
1126 PyTypeObject *tp = Py_TYPE(obj); in _PyObject_GetMethod() local
1141 if (tp->tp_dict == NULL && PyType_Ready(tp) < 0) in _PyObject_GetMethod()
1144 descr = _PyType_Lookup(tp, name); in _PyObject_GetMethod()
1192 tp->tp_name, name); in _PyObject_GetMethod()
1208 PyTypeObject *tp = Py_TYPE(obj); in _PyObject_GenericGetAttrWithDict() local
1223 if (tp->tp_dict == NULL) { in _PyObject_GenericGetAttrWithDict()
1224 if (PyType_Ready(tp) < 0) in _PyObject_GenericGetAttrWithDict()
1228 descr = _PyType_Lookup(tp, name); in _PyObject_GenericGetAttrWithDict()
1246 dictoffset = tp->tp_dictoffset; in _PyObject_GenericGetAttrWithDict()
1255 size = _PyObject_VAR_SIZE(tp, tsize); in _PyObject_GenericGetAttrWithDict()
1295 tp->tp_name, name); in _PyObject_GenericGetAttrWithDict()
1313 PyTypeObject *tp = Py_TYPE(obj); in _PyObject_GenericSetAttrWithDict() local
1326 if (tp->tp_dict == NULL && PyType_Ready(tp) < 0) in _PyObject_GenericSetAttrWithDict()
1331 descr = _PyType_Lookup(tp, name); in _PyObject_GenericSetAttrWithDict()
1348 tp->tp_name, name); in _PyObject_GenericSetAttrWithDict()
1353 tp->tp_name, name); in _PyObject_GenericSetAttrWithDict()
1357 res = _PyObjectDict_SetItem(tp, dictptr, name, value); in _PyObject_GenericSetAttrWithDict()