bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-… · python/cpython@a102ed7
@@ -170,7 +170,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
170170/* else get the type of the first base */
171171else {
172172PyObject *base0 = PyTuple_GET_ITEM(bases, 0);
173-meta = (PyObject *) (base0->ob_type);
173+meta = (PyObject *)Py_TYPE(base0);
174174 }
175175Py_INCREF(meta);
176176isclass = 1; /* meta is really a class */
@@ -1002,13 +1002,13 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
1002100210031003if (!PyDict_Check(globals)) {
10041004PyErr_Format(PyExc_TypeError, "exec() globals must be a dict, not %.100s",
1005-globals->ob_type->tp_name);
1005+Py_TYPE(globals)->tp_name);
10061006return NULL;
10071007 }
10081008if (!PyMapping_Check(locals)) {
10091009PyErr_Format(PyExc_TypeError,
10101010"locals must be a mapping or None, not %.100s",
1011-locals->ob_type->tp_name);
1011+Py_TYPE(locals)->tp_name);
10121012return NULL;
10131013 }
10141014if (_PyDict_GetItemIdWithError(globals, &PyId___builtins__) == NULL) {
@@ -1383,11 +1383,11 @@ builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
13831383if (!PyIter_Check(it)) {
13841384PyErr_Format(PyExc_TypeError,
13851385"'%.200s' object is not an iterator",
1386-it->ob_type->tp_name);
1386+Py_TYPE(it)->tp_name);
13871387return NULL;
13881388 }
138913891390-res = (*it->ob_type->tp_iternext)(it);
1390+res = (*Py_TYPE(it)->tp_iternext)(it);
13911391if (res != NULL) {
13921392return res;
13931393 } else if (nargs > 1) {
@@ -1788,7 +1788,7 @@ builtin_ord(PyObject *module, PyObject *c)
17881788else {
17891789PyErr_Format(PyExc_TypeError,
17901790"ord() expected string of length 1, but " \
1791-"%.200s found", c->ob_type->tp_name);
1791+"%.200s found", Py_TYPE(c)->tp_name);
17921792return NULL;
17931793 }
17941794@@ -1856,7 +1856,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
18561856else if (sep && !PyUnicode_Check(sep)) {
18571857PyErr_Format(PyExc_TypeError,
18581858"sep must be None or a string, not %.200s",
1859-sep->ob_type->tp_name);
1859+Py_TYPE(sep)->tp_name);
18601860return NULL;
18611861 }
18621862if (end == Py_None) {
@@ -1865,7 +1865,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
18651865else if (end && !PyUnicode_Check(end)) {
18661866PyErr_Format(PyExc_TypeError,
18671867"end must be None or a string, not %.200s",
1868-end->ob_type->tp_name);
1868+Py_TYPE(end)->tp_name);
18691869return NULL;
18701870 }
18711871