bpo-39573: Use Py_IS_TYPE to check for types (GH-19882)

diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index c06d79c..4d511a2 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -424,8 +424,8 @@
 static PyObject *
 ga_richcompare(PyObject *a, PyObject *b, int op)
 {
-    if (Py_TYPE(a) != &Py_GenericAliasType ||
-        Py_TYPE(b) != &Py_GenericAliasType ||
+    if (!Py_IS_TYPE(a, &Py_GenericAliasType) ||
+        !Py_IS_TYPE(b, &Py_GenericAliasType) ||
         (op != Py_EQ && op != Py_NE))
     {
         Py_RETURN_NOTIMPLEMENTED;