[pypy-commit] pypy default: issue 3141 part 2: use Py_TYPE(op) instead of (ob)->ob_type

mattip pypy.commits at gmail.com
Sat Jan 4 13:37:48 EST 2020


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r98443:433283f3338b
Date: 2020-01-04 20:14 +0200
http://bitbucket.org/pypy/pypy/changeset/433283f3338b/

Log:	issue 3141 part 2: use Py_TYPE(op) instead of (ob)->ob_type

diff --git a/pypy/module/cpyext/include/dictobject.h b/pypy/module/cpyext/include/dictobject.h
--- a/pypy/module/cpyext/include/dictobject.h
+++ b/pypy/module/cpyext/include/dictobject.h
@@ -13,8 +13,8 @@
 } PyDictObject;
 
 #define PyDict_Check(op) \
-		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_DICT_SUBCLASS)
-#define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type)
+		 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
+#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
 
 #ifdef __cplusplus
 }
diff --git a/pypy/module/cpyext/include/floatobject.h b/pypy/module/cpyext/include/floatobject.h
--- a/pypy/module/cpyext/include/floatobject.h
+++ b/pypy/module/cpyext/include/floatobject.h
@@ -33,8 +33,8 @@
         } while(0)
 
 #define PyFloat_Check(op) \
-		 _PyPy_Type_FastSubclass((op)->ob_type, Py_TPPYPYFLAGS_FLOAT_SUBCLASS)
-#define PyFloat_CheckExact(op) ((op)->ob_type == &PyFloat_Type)
+		 _PyPy_Type_FastSubclass(Py_TYPE(op), Py_TPPYPYFLAGS_FLOAT_SUBCLASS)
+#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
 
 
 #ifdef __cplusplus
diff --git a/pypy/module/cpyext/include/listobject.h b/pypy/module/cpyext/include/listobject.h
--- a/pypy/module/cpyext/include/listobject.h
+++ b/pypy/module/cpyext/include/listobject.h
@@ -1,4 +1,4 @@
 /* empty */
 #define PyList_Check(op) \
-		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LIST_SUBCLASS)
-#define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type)
+		 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
+#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
diff --git a/pypy/module/cpyext/include/longobject.h b/pypy/module/cpyext/include/longobject.h
--- a/pypy/module/cpyext/include/longobject.h
+++ b/pypy/module/cpyext/include/longobject.h
@@ -15,8 +15,8 @@
 #define PyOS_strtoul strtoul
 #define PyOS_strtol strtoul
 #define PyLong_Check(op) \
-		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LONG_SUBCLASS)
-#define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type)
+		 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
+#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
 
 #define _PyLong_AsByteArray(v, bytes, n, little_endian, is_signed)   \
     _PyLong_AsByteArrayO((PyObject *)(v), bytes, n, little_endian, is_signed)
diff --git a/pypy/module/cpyext/include/sliceobject.h b/pypy/module/cpyext/include/sliceobject.h
--- a/pypy/module/cpyext/include/sliceobject.h
+++ b/pypy/module/cpyext/include/sliceobject.h
@@ -17,7 +17,7 @@
     PyObject *step;
 } PySliceObject;
 
-#define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
+#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
     
 #ifdef __cplusplus
 }
diff --git a/pypy/module/cpyext/include/tupleobject.h b/pypy/module/cpyext/include/tupleobject.h
--- a/pypy/module/cpyext/include/tupleobject.h
+++ b/pypy/module/cpyext/include/tupleobject.h
@@ -32,8 +32,8 @@
 #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
 
 #define PyTuple_Check(op) \
-		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
-#define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
+		 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
+#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)
 
 #ifdef __cplusplus
 }
diff --git a/pypy/module/cpyext/include/unicodeobject.h b/pypy/module/cpyext/include/unicodeobject.h
--- a/pypy/module/cpyext/include/unicodeobject.h
+++ b/pypy/module/cpyext/include/unicodeobject.h
@@ -11,8 +11,8 @@
 PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char *format, ...);
 
 #define PyUnicode_Check(op) \
-		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_UNICODE_SUBCLASS)
-#define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type)
+		 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
+#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
 
 #ifdef __cplusplus
 }


More information about the pypy-commit mailing list