summaryrefslogtreecommitdiff
path: root/Objects/listobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index c93a0feaf3..d83e3cfcf1 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -493,7 +493,7 @@ list_concat(PyListObject *a, PyObject *bb)
if (!PyList_Check(bb)) {
PyErr_Format(PyExc_TypeError,
"can only concatenate list (not \"%.200s\") to list",
- bb->ob_type->tp_name);
+ Py_TYPE(bb)->tp_name);
return NULL;
}
#define b ((PyListObject *)bb)
@@ -892,7 +892,7 @@ list_extend(PyListObject *self, PyObject *iterable)
it = PyObject_GetIter(iterable);
if (it == NULL)
return NULL;
- iternext = *it->ob_type->tp_iternext;
+ iternext = *Py_TYPE(it)->tp_iternext;
/* Guess a result list size. */
n = PyObject_LengthHint(iterable, 8);
@@ -1179,7 +1179,7 @@ struct s_MergeState {
/* This function is used by unsafe_object_compare to optimize comparisons
* when we know our list is type-homogeneous but we can't assume anything else.
- * In the pre-sort check it is set equal to key->ob_type->tp_richcompare */
+ * In the pre-sort check it is set equal to Py_TYPE(key)->tp_richcompare */
PyObject *(*key_richcompare)(PyObject *, PyObject *, int);
/* This function is used by unsafe_tuple_compare to compare the first elements
@@ -2015,7 +2015,7 @@ unsafe_object_compare(PyObject *v, PyObject *w, MergeState *ms)
PyObject *res_obj; int res;
/* No assumptions, because we check first: */
- if (v->ob_type->tp_richcompare != ms->key_richcompare)
+ if (Py_TYPE(v)->tp_richcompare != ms->key_richcompare)
return PyObject_RichCompareBool(v, w, Py_LT);
assert(ms->key_richcompare != NULL);
@@ -2052,8 +2052,8 @@ unsafe_latin_compare(PyObject *v, PyObject *w, MergeState *ms)
int res;
/* Modified from Objects/unicodeobject.c:unicode_compare, assuming: */
- assert(v->ob_type == w->ob_type);
- assert(v->ob_type == &PyUnicode_Type);
+ assert(Py_TYPE(v) == Py_TYPE(w));
+ assert(Py_TYPE(v) == &PyUnicode_Type);
assert(PyUnicode_KIND(v) == PyUnicode_KIND(w));
assert(PyUnicode_KIND(v) == PyUnicode_1BYTE_KIND);
@@ -2075,8 +2075,8 @@ unsafe_long_compare(PyObject *v, PyObject *w, MergeState *ms)
PyLongObject *vl, *wl; sdigit v0, w0; int res;
/* Modified from Objects/longobject.c:long_compare, assuming: */
- assert(v->ob_type == w->ob_type);
- assert(v->ob_type == &PyLong_Type);
+ assert(Py_TYPE(v) == Py_TYPE(w));
+ assert(Py_TYPE(v) == &PyLong_Type);
assert(Py_ABS(Py_SIZE(v)) <= 1);
assert(Py_ABS(Py_SIZE(w)) <= 1);
@@ -2103,8 +2103,8 @@ unsafe_float_compare(PyObject *v, PyObject *w, MergeState *ms)
int res;
/* Modified from Objects/floatobject.c:float_richcompare, assuming: */
- assert(v->ob_type == w->ob_type);
- assert(v->ob_type == &PyFloat_Type);
+ assert(Py_TYPE(v) == Py_TYPE(w));
+ assert(Py_TYPE(v) == &PyFloat_Type);
res = PyFloat_AS_DOUBLE(v) < PyFloat_AS_DOUBLE(w);
assert(res == PyObject_RichCompareBool(v, w, Py_LT));
@@ -2125,8 +2125,8 @@ unsafe_tuple_compare(PyObject *v, PyObject *w, MergeState *ms)
int k;
/* Modified from Objects/tupleobject.c:tuplerichcompare, assuming: */
- assert(v->ob_type == w->ob_type);
- assert(v->ob_type == &PyTuple_Type);
+ assert(Py_TYPE(v) == Py_TYPE(w));
+ assert(Py_TYPE(v) == &PyTuple_Type);
assert(Py_SIZE(v) > 0);
assert(Py_SIZE(w) > 0);
@@ -2247,12 +2247,12 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
* set ms appropriately. */
if (saved_ob_size > 1) {
/* Assume the first element is representative of the whole list. */
- int keys_are_in_tuples = (lo.keys[0]->ob_type == &PyTuple_Type &&
+ int keys_are_in_tuples = (Py_TYPE(lo.keys[0]) == &PyTuple_Type &&
Py_SIZE(lo.keys[0]) > 0);
PyTypeObject* key_type = (keys_are_in_tuples ?
- PyTuple_GET_ITEM(lo.keys[0], 0)->ob_type :
- lo.keys[0]->ob_type);
+ Py_TYPE(PyTuple_GET_ITEM(lo.keys[0], 0)) :
+ Py_TYPE(lo.keys[0]));
int keys_are_all_same_type = 1;
int strings_are_latin = 1;
@@ -2262,7 +2262,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
for (i=0; i < saved_ob_size; i++) {
if (keys_are_in_tuples &&
- !(lo.keys[i]->ob_type == &PyTuple_Type && Py_SIZE(lo.keys[i]) != 0)) {
+ !(Py_TYPE(lo.keys[i]) == &PyTuple_Type && Py_SIZE(lo.keys[i]) != 0)) {
keys_are_in_tuples = 0;
keys_are_all_same_type = 0;
break;
@@ -2275,7 +2275,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
PyTuple_GET_ITEM(lo.keys[i], 0) :
lo.keys[i]);
- if (key->ob_type != key_type) {
+ if (Py_TYPE(key) != key_type) {
keys_are_all_same_type = 0;
/* If keys are in tuple we must loop over the whole list to make
sure all items are tuples */
@@ -2818,7 +2818,7 @@ list_subscript(PyListObject* self, PyObject* item)
else {
PyErr_Format(PyExc_TypeError,
"list indices must be integers or slices, not %.200s",
- item->ob_type->tp_name);
+ Py_TYPE(item)->tp_name);
return NULL;
}
}
@@ -2981,7 +2981,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
else {
PyErr_Format(PyExc_TypeError,
"list indices must be integers or slices, not %.200s",
- item->ob_type->tp_name);
+ Py_TYPE(item)->tp_name);
return -1;
}
}