bpo-39573: Use Py_TYPE() macro in Objects directory (GH-18392) · python/cpython@58ac700
@@ -84,7 +84,7 @@ descr_check(PyDescrObject *descr, PyObject *obj, PyObject **pres)
8484"doesn't apply to a '%.100s' object",
8585descr_name((PyDescrObject *)descr), "?",
8686descr->d_type->tp_name,
87-obj->ob_type->tp_name);
87+Py_TYPE(obj)->tp_name);
8888*pres = NULL;
8989return 1;
9090 }
@@ -97,7 +97,7 @@ classmethod_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type)
9797/* Ensure a valid type. Class methods ignore obj. */
9898if (type == NULL) {
9999if (obj != NULL)
100-type = (PyObject *)obj->ob_type;
100+type = (PyObject *)Py_TYPE(obj);
101101else {
102102/* Wot - no type?! */
103103PyErr_Format(PyExc_TypeError,
@@ -114,7 +114,7 @@ classmethod_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type)
114114"needs a type, not a '%.100s' as arg 2",
115115descr_name((PyDescrObject *)descr), "?",
116116PyDescr_TYPE(descr)->tp_name,
117-type->ob_type->tp_name);
117+Py_TYPE(type)->tp_name);
118118return NULL;
119119 }
120120if (!PyType_IsSubtype((PyTypeObject *)type, PyDescr_TYPE(descr))) {
@@ -194,7 +194,7 @@ descr_setcheck(PyDescrObject *descr, PyObject *obj, PyObject *value,
194194"doesn't apply to a '%.100s' object",
195195descr_name(descr), "?",
196196descr->d_type->tp_name,
197-obj->ob_type->tp_name);
197+Py_TYPE(obj)->tp_name);
198198*pres = -1;
199199return 1;
200200 }
@@ -506,7 +506,7 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
506506"but received a '%.100s'",
507507descr_name((PyDescrObject *)descr), "?",
508508PyDescr_TYPE(descr)->tp_name,
509-self->ob_type->tp_name);
509+Py_TYPE(self)->tp_name);
510510return NULL;
511511 }
512512@@ -1234,7 +1234,7 @@ wrapper_repr(wrapperobject *wp)
12341234{
12351235return PyUnicode_FromFormat("<method-wrapper '%s' of %s object at %p>",
12361236wp->descr->d_base->name,
1237-wp->self->ob_type->tp_name,
1237+Py_TYPE(wp->self)->tp_name,
12381238wp->self);
12391239}
12401240@@ -1476,7 +1476,7 @@ property_dealloc(PyObject *self)
14761476Py_XDECREF(gs->prop_set);
14771477Py_XDECREF(gs->prop_del);
14781478Py_XDECREF(gs->prop_doc);
1479-self->ob_type->tp_free(self);
1479+Py_TYPE(self)->tp_free(self);
14801480}
1481148114821482static PyObject *