bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)

diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index c5a6f44..2718c61 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -54,7 +54,7 @@
 static PyTypeObject PyProfiler_Type;
 
 #define PyProfiler_Check(op) PyObject_TypeCheck(op, &PyProfiler_Type)
-#define PyProfiler_CheckExact(op) (Py_TYPE(op) == &PyProfiler_Type)
+#define PyProfiler_CheckExact(op) Py_IS_TYPE(op, &PyProfiler_Type)
 
 /*** External Timers ***/