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

diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 53849e3..c18af7e 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -83,7 +83,7 @@
 } PyCursesPanelObject;
 
 #define PyCursesPanel_Check(v)  \
- (Py_TYPE(v) == _curses_panelstate_global->PyCursesPanel_Type)
+ Py_IS_TYPE(v, _curses_panelstate_global->PyCursesPanel_Type)
 
 /* Some helper functions. The problem is that there's always a window
    associated with a panel. To ensure that Python's GC doesn't pull