@@ -493,7 +493,7 @@ list_concat(PyListObject *a, PyObject *bb)
493
493
if (!PyList_Check (bb )) {
494
494
PyErr_Format (PyExc_TypeError ,
495
495
"can only concatenate list (not \"%.200s\") to list" ,
496
- bb -> ob_type -> tp_name );
496
+ Py_TYPE ( bb ) -> tp_name );
497
497
return NULL ;
498
498
}
499
499
#define b ((PyListObject *)bb)
@@ -892,7 +892,7 @@ list_extend(PyListObject *self, PyObject *iterable)
892
892
it = PyObject_GetIter (iterable );
893
893
if (it == NULL )
894
894
return NULL ;
895
- iternext = * it -> ob_type -> tp_iternext ;
895
+ iternext = * Py_TYPE ( it ) -> tp_iternext ;
896
896
897
897
/* Guess a result list size. */
898
898
n = PyObject_LengthHint (iterable , 8 );
@@ -1179,7 +1179,7 @@ struct s_MergeState {
1179
1179
1180
1180
/* This function is used by unsafe_object_compare to optimize comparisons
1181
1181
* when we know our list is type-homogeneous but we can't assume anything else.
1182
- * In the pre-sort check it is set equal to key->ob_type ->tp_richcompare */
1182
+ * In the pre-sort check it is set equal to Py_TYPE( key) ->tp_richcompare */
1183
1183
PyObject * (* key_richcompare )(PyObject * , PyObject * , int );
1184
1184
1185
1185
/* 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)
2015
2015
PyObject * res_obj ; int res ;
2016
2016
2017
2017
/* No assumptions, because we check first: */
2018
- if (v -> ob_type -> tp_richcompare != ms -> key_richcompare )
2018
+ if (Py_TYPE ( v ) -> tp_richcompare != ms -> key_richcompare )
2019
2019
return PyObject_RichCompareBool (v , w , Py_LT );
2020
2020
2021
2021
assert (ms -> key_richcompare != NULL );
@@ -2052,8 +2052,8 @@ unsafe_latin_compare(PyObject *v, PyObject *w, MergeState *ms)
2052
2052
int res ;
2053
2053
2054
2054
/* Modified from Objects/unicodeobject.c:unicode_compare, assuming: */
2055
- assert (v -> ob_type == w -> ob_type );
2056
- assert (v -> ob_type == & PyUnicode_Type );
2055
+ assert (Py_TYPE ( v ) == Py_TYPE ( w ) );
2056
+ assert (Py_TYPE ( v ) == & PyUnicode_Type );
2057
2057
assert (PyUnicode_KIND (v ) == PyUnicode_KIND (w ));
2058
2058
assert (PyUnicode_KIND (v ) == PyUnicode_1BYTE_KIND );
2059
2059
@@ -2075,8 +2075,8 @@ unsafe_long_compare(PyObject *v, PyObject *w, MergeState *ms)
2075
2075
PyLongObject * vl , * wl ; sdigit v0 , w0 ; int res ;
2076
2076
2077
2077
/* Modified from Objects/longobject.c:long_compare, assuming: */
2078
- assert (v -> ob_type == w -> ob_type );
2079
- assert (v -> ob_type == & PyLong_Type );
2078
+ assert (Py_TYPE ( v ) == Py_TYPE ( w ) );
2079
+ assert (Py_TYPE ( v ) == & PyLong_Type );
2080
2080
assert (Py_ABS (Py_SIZE (v )) <= 1 );
2081
2081
assert (Py_ABS (Py_SIZE (w )) <= 1 );
2082
2082
@@ -2103,8 +2103,8 @@ unsafe_float_compare(PyObject *v, PyObject *w, MergeState *ms)
2103
2103
int res ;
2104
2104
2105
2105
/* Modified from Objects/floatobject.c:float_richcompare, assuming: */
2106
- assert (v -> ob_type == w -> ob_type );
2107
- assert (v -> ob_type == & PyFloat_Type );
2106
+ assert (Py_TYPE ( v ) == Py_TYPE ( w ) );
2107
+ assert (Py_TYPE ( v ) == & PyFloat_Type );
2108
2108
2109
2109
res = PyFloat_AS_DOUBLE (v ) < PyFloat_AS_DOUBLE (w );
2110
2110
assert (res == PyObject_RichCompareBool (v , w , Py_LT ));
@@ -2125,8 +2125,8 @@ unsafe_tuple_compare(PyObject *v, PyObject *w, MergeState *ms)
2125
2125
int k ;
2126
2126
2127
2127
/* Modified from Objects/tupleobject.c:tuplerichcompare, assuming: */
2128
- assert (v -> ob_type == w -> ob_type );
2129
- assert (v -> ob_type == & PyTuple_Type );
2128
+ assert (Py_TYPE ( v ) == Py_TYPE ( w ) );
2129
+ assert (Py_TYPE ( v ) == & PyTuple_Type );
2130
2130
assert (Py_SIZE (v ) > 0 );
2131
2131
assert (Py_SIZE (w ) > 0 );
2132
2132
@@ -2247,12 +2247,12 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
2247
2247
* set ms appropriately. */
2248
2248
if (saved_ob_size > 1 ) {
2249
2249
/* Assume the first element is representative of the whole list. */
2250
- int keys_are_in_tuples = (lo .keys [0 ]-> ob_type == & PyTuple_Type &&
2250
+ int keys_are_in_tuples = (Py_TYPE ( lo .keys [0 ]) == & PyTuple_Type &&
2251
2251
Py_SIZE (lo .keys [0 ]) > 0 );
2252
2252
2253
2253
PyTypeObject * key_type = (keys_are_in_tuples ?
2254
- PyTuple_GET_ITEM (lo .keys [0 ], 0 )-> ob_type :
2255
- lo .keys [0 ]-> ob_type );
2254
+ Py_TYPE ( PyTuple_GET_ITEM (lo .keys [0 ], 0 )) :
2255
+ Py_TYPE ( lo .keys [0 ]) );
2256
2256
2257
2257
int keys_are_all_same_type = 1 ;
2258
2258
int strings_are_latin = 1 ;
@@ -2262,7 +2262,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
2262
2262
for (i = 0 ; i < saved_ob_size ; i ++ ) {
2263
2263
2264
2264
if (keys_are_in_tuples &&
2265
- !(lo .keys [i ]-> ob_type == & PyTuple_Type && Py_SIZE (lo .keys [i ]) != 0 )) {
2265
+ !(Py_TYPE ( lo .keys [i ]) == & PyTuple_Type && Py_SIZE (lo .keys [i ]) != 0 )) {
2266
2266
keys_are_in_tuples = 0 ;
2267
2267
keys_are_all_same_type = 0 ;
2268
2268
break ;
@@ -2275,7 +2275,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
2275
2275
PyTuple_GET_ITEM (lo .keys [i ], 0 ) :
2276
2276
lo .keys [i ]);
2277
2277
2278
- if (key -> ob_type != key_type ) {
2278
+ if (Py_TYPE ( key ) != key_type ) {
2279
2279
keys_are_all_same_type = 0 ;
2280
2280
/* If keys are in tuple we must loop over the whole list to make
2281
2281
sure all items are tuples */
@@ -2818,7 +2818,7 @@ list_subscript(PyListObject* self, PyObject* item)
2818
2818
else {
2819
2819
PyErr_Format (PyExc_TypeError ,
2820
2820
"list indices must be integers or slices, not %.200s" ,
2821
- item -> ob_type -> tp_name );
2821
+ Py_TYPE ( item ) -> tp_name );
2822
2822
return NULL ;
2823
2823
}
2824
2824
}
@@ -2981,7 +2981,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
2981
2981
else {
2982
2982
PyErr_Format (PyExc_TypeError ,
2983
2983
"list indices must be integers or slices, not %.200s" ,
2984
- item -> ob_type -> tp_name );
2984
+ Py_TYPE ( item ) -> tp_name );
2985
2985
return -1 ;
2986
2986
}
2987
2987
}
0 commit comments