aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-07 03:04:21 +0100
committerGitHub <noreply@github.com>2020-02-07 03:04:21 +0100
commit58ac700fb09497df14d4492b6f820109490b2b88 (patch)
treed6a87b277dd133543974b1b24cf65df4c5c8eff4 /Objects/complexobject.c
parentbpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391) (diff)
downloadcpython-58ac700fb09497df14d4492b6f820109490b2b88.tar.gz
cpython-58ac700fb09497df14d4492b6f820109490b2b88.tar.bz2
cpython-58ac700fb09497df14d4492b6f820109490b2b88.zip
bpo-39573: Use Py_TYPE() macro in Objects directory (GH-18392)
Replace direct access to PyObject.ob_type with Py_TYPE().
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index f1b76673efd..8d1461b29b4 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -296,7 +296,7 @@ try_complex_special_method(PyObject *op)
if (!PyComplex_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__complex__ returned non-complex (type %.200s)",
- res->ob_type->tp_name);
+ Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
@@ -305,7 +305,7 @@ try_complex_special_method(PyObject *op)
"__complex__ returned non-complex (type %.200s). "
"The ability to return an instance of a strict subclass of complex "
"is deprecated, and may be removed in a future version of Python.",
- res->ob_type->tp_name)) {
+ Py_TYPE(res)->tp_name)) {
Py_DECREF(res);
return NULL;
}
@@ -958,7 +958,7 @@ complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
return NULL;
}
- nbr = r->ob_type->tp_as_number;
+ nbr = Py_TYPE(r)->tp_as_number;
if (nbr == NULL || (nbr->nb_float == NULL && nbr->nb_index == NULL)) {
PyErr_Format(PyExc_TypeError,
"complex() first argument must be a string or a number, "
@@ -970,7 +970,7 @@ complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
return NULL;
}
if (i != NULL) {
- nbi = i->ob_type->tp_as_number;
+ nbi = Py_TYPE(i)->tp_as_number;
if (nbi == NULL || (nbi->nb_float == NULL && nbi->nb_index == NULL)) {
PyErr_Format(PyExc_TypeError,
"complex() second argument must be a number, "