@@ -184,19 +184,19 @@ typedef struct {
184184
185185/* Macros for type checking when building the Python core. */
186186#define PyDate_Check (op ) PyObject_TypeCheck(op, &PyDateTime_DateType)
187- #define PyDate_CheckExact (op ) (Py_TYPE(op) == &PyDateTime_DateType)
187+ #define PyDate_CheckExact (op ) Py_IS_TYPE(op, &PyDateTime_DateType)
188188
189189#define PyDateTime_Check (op ) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
190- #define PyDateTime_CheckExact (op ) (Py_TYPE(op) == &PyDateTime_DateTimeType)
190+ #define PyDateTime_CheckExact (op ) Py_IS_TYPE(op, &PyDateTime_DateTimeType)
191191
192192#define PyTime_Check (op ) PyObject_TypeCheck(op, &PyDateTime_TimeType)
193- #define PyTime_CheckExact (op ) (Py_TYPE(op) == &PyDateTime_TimeType)
193+ #define PyTime_CheckExact (op ) Py_IS_TYPE(op, &PyDateTime_TimeType)
194194
195195#define PyDelta_Check (op ) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
196- #define PyDelta_CheckExact (op ) (Py_TYPE(op) == &PyDateTime_DeltaType)
196+ #define PyDelta_CheckExact (op ) Py_IS_TYPE(op, &PyDateTime_DeltaType)
197197
198198#define PyTZInfo_Check (op ) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
199- #define PyTZInfo_CheckExact (op ) (Py_TYPE(op) == &PyDateTime_TZInfoType)
199+ #define PyTZInfo_CheckExact (op ) Py_IS_TYPE(op, &PyDateTime_TZInfoType)
200200
201201#else
202202
@@ -211,19 +211,19 @@ static PyDateTime_CAPI *PyDateTimeAPI = NULL;
211211
212212/* Macros for type checking when not building the Python core. */
213213#define PyDate_Check (op ) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
214- #define PyDate_CheckExact (op ) (Py_TYPE(op) == PyDateTimeAPI->DateType)
214+ #define PyDate_CheckExact (op ) Py_IS_TYPE(op, PyDateTimeAPI->DateType)
215215
216216#define PyDateTime_Check (op ) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
217- #define PyDateTime_CheckExact (op ) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType)
217+ #define PyDateTime_CheckExact (op ) Py_IS_TYPE(op, PyDateTimeAPI->DateTimeType)
218218
219219#define PyTime_Check (op ) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
220- #define PyTime_CheckExact (op ) (Py_TYPE(op) == PyDateTimeAPI->TimeType)
220+ #define PyTime_CheckExact (op ) Py_IS_TYPE(op, PyDateTimeAPI->TimeType)
221221
222222#define PyDelta_Check (op ) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
223- #define PyDelta_CheckExact (op ) (Py_TYPE(op) == PyDateTimeAPI->DeltaType)
223+ #define PyDelta_CheckExact (op ) Py_IS_TYPE(op, PyDateTimeAPI->DeltaType)
224224
225225#define PyTZInfo_Check (op ) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
226- #define PyTZInfo_CheckExact (op ) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType)
226+ #define PyTZInfo_CheckExact (op ) Py_IS_TYPE(op, PyDateTimeAPI->TZInfoType)
227227
228228/* Macros for accessing constructors in a simplified fashion. */
229229#define PyDate_FromDate (year , month , day ) \
0 commit comments