bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-… · python/cpython@a102ed7 (original) (raw)
`@@ -170,7 +170,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
`
170
170
`/* else get the type of the first base */
`
171
171
`else {
`
172
172
`PyObject *base0 = PyTuple_GET_ITEM(bases, 0);
`
173
``
`-
meta = (PyObject *) (base0->ob_type);
`
``
173
`+
meta = (PyObject *)Py_TYPE(base0);
`
174
174
` }
`
175
175
`Py_INCREF(meta);
`
176
176
`isclass = 1; /* meta is really a class */
`
`@@ -1002,13 +1002,13 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
`
1002
1002
``
1003
1003
`if (!PyDict_Check(globals)) {
`
1004
1004
`PyErr_Format(PyExc_TypeError, "exec() globals must be a dict, not %.100s",
`
1005
``
`-
globals->ob_type->tp_name);
`
``
1005
`+
Py_TYPE(globals)->tp_name);
`
1006
1006
`return NULL;
`
1007
1007
` }
`
1008
1008
`if (!PyMapping_Check(locals)) {
`
1009
1009
`PyErr_Format(PyExc_TypeError,
`
1010
1010
`"locals must be a mapping or None, not %.100s",
`
1011
``
`-
locals->ob_type->tp_name);
`
``
1011
`+
Py_TYPE(locals)->tp_name);
`
1012
1012
`return NULL;
`
1013
1013
` }
`
1014
1014
`if (PyDict_GetItemIdWithError(globals, &PyId___builtins_) == NULL) {
`
`@@ -1383,11 +1383,11 @@ builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
`
1383
1383
`if (!PyIter_Check(it)) {
`
1384
1384
`PyErr_Format(PyExc_TypeError,
`
1385
1385
`"'%.200s' object is not an iterator",
`
1386
``
`-
it->ob_type->tp_name);
`
``
1386
`+
Py_TYPE(it)->tp_name);
`
1387
1387
`return NULL;
`
1388
1388
` }
`
1389
1389
``
1390
``
`-
res = (*it->ob_type->tp_iternext)(it);
`
``
1390
`+
res = (*Py_TYPE(it)->tp_iternext)(it);
`
1391
1391
`if (res != NULL) {
`
1392
1392
`return res;
`
1393
1393
` } else if (nargs > 1) {
`
`@@ -1788,7 +1788,7 @@ builtin_ord(PyObject *module, PyObject *c)
`
1788
1788
`else {
`
1789
1789
`PyErr_Format(PyExc_TypeError,
`
1790
1790
`"ord() expected string of length 1, but " \
`
1791
``
`-
"%.200s found", c->ob_type->tp_name);
`
``
1791
`+
"%.200s found", Py_TYPE(c)->tp_name);
`
1792
1792
`return NULL;
`
1793
1793
` }
`
1794
1794
``
`@@ -1856,7 +1856,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
`
1856
1856
`else if (sep && !PyUnicode_Check(sep)) {
`
1857
1857
`PyErr_Format(PyExc_TypeError,
`
1858
1858
`"sep must be None or a string, not %.200s",
`
1859
``
`-
sep->ob_type->tp_name);
`
``
1859
`+
Py_TYPE(sep)->tp_name);
`
1860
1860
`return NULL;
`
1861
1861
` }
`
1862
1862
`if (end == Py_None) {
`
`@@ -1865,7 +1865,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
`
1865
1865
`else if (end && !PyUnicode_Check(end)) {
`
1866
1866
`PyErr_Format(PyExc_TypeError,
`
1867
1867
`"end must be None or a string, not %.200s",
`
1868
``
`-
end->ob_type->tp_name);
`
``
1868
`+
Py_TYPE(end)->tp_name);
`
1869
1869
`return NULL;
`
1870
1870
` }
`
1871
1871
``