bpo-39573: Add Py_IS_TYPE() function (GH-18488)

Co-Author: Neil Schemenauer <nas-github@arctrix.com>
diff --git a/Include/bytearrayobject.h b/Include/bytearrayobject.h
index 341ab38..9e95433 100644
--- a/Include/bytearrayobject.h
+++ b/Include/bytearrayobject.h
@@ -24,7 +24,7 @@
 
 /* Type check macros */
 #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
-#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type)
+#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
 
 /* Direct API functions */
 PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);