diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-07 02:24:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 02:24:48 +0100 |
commit | a102ed7d2f0e7e05438f14d5fb72ca0358602249 (patch) | |
tree | a5a3aca7a251c82d7b35c130cc913d6009baa18a /Python/bltinmodule.c | |
parent | 38aaaaac805fa30870e2d093e52a900dddde3b34 (diff) | |
download | cpython-a102ed7d2f0e7e05438f14d5fb72ca0358602249.tar.gz cpython-a102ed7d2f0e7e05438f14d5fb72ca0358602249.zip |
bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391)
Replace direct access to PyObject.ob_type with Py_TYPE().
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index cdb1eaaff01..980b81041b4 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -170,7 +170,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs, /* else get the type of the first base */ else { PyObject *base0 = PyTuple_GET_ITEM(bases, 0); - meta = (PyObject *) (base0->ob_type); + meta = (PyObject *)Py_TYPE(base0); } Py_INCREF(meta); isclass = 1; /* meta is really a class */ @@ -1002,13 +1002,13 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, if (!PyDict_Check(globals)) { PyErr_Format(PyExc_TypeError, "exec() globals must be a dict, not %.100s", - globals->ob_type->tp_name); + Py_TYPE(globals)->tp_name); return NULL; } if (!PyMapping_Check(locals)) { PyErr_Format(PyExc_TypeError, "locals must be a mapping or None, not %.100s", - locals->ob_type->tp_name); + Py_TYPE(locals)->tp_name); return NULL; } if (_PyDict_GetItemIdWithError(globals, &PyId___builtins__) == NULL) { @@ -1383,11 +1383,11 @@ builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs) if (!PyIter_Check(it)) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not an iterator", - it->ob_type->tp_name); + Py_TYPE(it)->tp_name); return NULL; } - res = (*it->ob_type->tp_iternext)(it); + res = (*Py_TYPE(it)->tp_iternext)(it); if (res != NULL) { return res; } else if (nargs > 1) { @@ -1788,7 +1788,7 @@ builtin_ord(PyObject *module, PyObject *c) else { PyErr_Format(PyExc_TypeError, "ord() expected string of length 1, but " \ - "%.200s found", c->ob_type->tp_name); + "%.200s found", Py_TYPE(c)->tp_name); return NULL; } @@ -1856,7 +1856,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject else if (sep && !PyUnicode_Check(sep)) { PyErr_Format(PyExc_TypeError, "sep must be None or a string, not %.200s", - sep->ob_type->tp_name); + Py_TYPE(sep)->tp_name); return NULL; } if (end == Py_None) { @@ -1865,7 +1865,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject else if (end && !PyUnicode_Check(end)) { PyErr_Format(PyExc_TypeError, "end must be None or a string, not %.200s", - end->ob_type->tp_name); + Py_TYPE(end)->tp_name); return NULL; } |