bpo-39573: Use Py_TYPE() macro in Objects directory (GH-18392)
Replace direct access to PyObject.ob_type with Py_TYPE().
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index fa48ee1..fd08ddb 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8401,7 +8401,7 @@
/* wrong return value */
PyErr_Format(PyExc_TypeError,
"character mapping must return integer, bytes or None, not %.400s",
- x->ob_type->tp_name);
+ Py_TYPE(x)->tp_name);
Py_DECREF(x);
return NULL;
}
@@ -11082,8 +11082,8 @@
}
PyErr_Format(PyExc_TypeError,
"Can't compare %.100s and %.100s",
- left->ob_type->tp_name,
- right->ob_type->tp_name);
+ Py_TYPE(left)->tp_name,
+ Py_TYPE(right)->tp_name);
return -1;
}
@@ -11353,7 +11353,7 @@
if (!PyUnicode_Check(right)) {
PyErr_Format(PyExc_TypeError,
"can only concatenate str (not \"%.200s\") to str",
- right->ob_type->tp_name);
+ Py_TYPE(right)->tp_name);
return NULL;
}
if (PyUnicode_READY(right) < 0)