bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)

diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 2f1b47a..d9536bb 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1,6 +1,6 @@
 #include "Python.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
 #include "structmember.h"
 
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 6e76db4..4ec42eb 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -10,7 +10,6 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_object.h"
-#include "pycore_pystate.h"
 #include "structmember.h"
 #include "pythread.h"
 #include "_iomodule.h"
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 95b023d..9e33c1e 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -8,8 +8,9 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_interp.h"      // PyInterpreterState.fs_codec
 #include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"     // _PyInterpreterState_GET()
 #include "structmember.h"
 #include "_iomodule.h"
 
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 5636140..8ff0669 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -5,7 +5,7 @@
 #include "Python.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_interp.h"       // _PyInterpreterState.num_threads
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyThreadState_Init()
 #include "pythread.h"
 #include <stddef.h>              // offsetof()
 
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 1754182..281ab33 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -26,13 +26,14 @@
 #include "Python.h"
 #include "pycore_context.h"
 #include "pycore_initconfig.h"
+#include "pycore_interp.h"      // PyInterpreterState.gc
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
+#include "pycore_pystate.h"     // _PyThreadState_GET()
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
-#include "frameobject.h"        /* for PyFrame_ClearFreeList */
+#include "frameobject.h"        // PyFrame_ClearFreeList
 #include "pydtrace.h"
-#include "pytime.h"             /* for _PyTime_GetMonotonicClock() */
+#include "pytime.h"             // _PyTime_GetMonotonicClock()
 
 typedef struct _gc_runtime_state GCState;
 
diff --git a/Modules/getpath.c b/Modules/getpath.c
index e97ea8b..1dd8dd0 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -1,11 +1,10 @@
 /* Return the initial module search path. */
 
 #include "Python.h"
-#include "pycore_initconfig.h"
-#include "osdefs.h"
 #include "pycore_fileutils.h"
+#include "pycore_initconfig.h"
 #include "pycore_pathconfig.h"
-#include "pycore_pystate.h"
+#include "osdefs.h"
 
 #include <sys/types.h>
 #include <string.h>
diff --git a/Modules/main.c b/Modules/main.c
index fb24c6c..fa9c6b4 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -6,7 +6,7 @@
 #include "pycore_pathconfig.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyInterpreterState_GET()
 
 /* Includes for exit_sigint() */
 #include <stdio.h>      /* perror() */
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2d603d1..692dda3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -37,7 +37,7 @@
 
 #include "pycore_ceval.h"     /* _PyEval_ReInitThreads() */
 #include "pycore_import.h"    /* _PyImport_ReInitLock() */
-#include "pycore_pystate.h"   /* _PyRuntime */
+#include "pycore_pystate.h"   /* _PyInterpreterState_GET() */
 #include "pythread.h"
 #include "structmember.h"
 #ifndef MS_WINDOWS
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index ceb986b..69d69ac 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -8,7 +8,7 @@
 #include "pycore_call.h"
 #include "pycore_ceval.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"    // _PyThreadState_GET()
 
 #ifndef MS_WINDOWS
 #include "posixmodule.h"
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 7e1e51b..8e22dfe 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -4,7 +4,7 @@
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_ceval.h"      // _Py_EnterRecursiveCall()
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"    // _PyThreadState_GET()
 #include <ctype.h>
 #include "structmember.h" /* we need the offsetof() macro from there */
 #include "longintrepr.h"
diff --git a/Objects/call.c b/Objects/call.c
index 0861414..61426c7 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -1,9 +1,9 @@
 #include "Python.h"
 #include "pycore_call.h"
-#include "pycore_ceval.h"   /* _PyEval_EvalFrame() */
+#include "pycore_ceval.h"        // _PyEval_EvalFrame()
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
 #include "frameobject.h"
 
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index e97feef..6efae62 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -3,7 +3,6 @@
 #include "Python.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 
 PyObject *
 PyCell_New(PyObject *obj)
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 999b91c..ce4bf7b 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -4,7 +4,7 @@
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyThreadState_GET()
 #include "structmember.h"
 
 #define TP_DESCR_GET(t) ((t)->tp_descr_get)
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 5fab222..fe7ba79 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1,9 +1,9 @@
 /* Descriptors -- a new, flexible way to describe attributes */
 
 #include "Python.h"
-#include "pycore_ceval.h"   // _Py_EnterRecursiveCall()
+#include "pycore_ceval.h"        // _Py_EnterRecursiveCall()
 #include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
 #include "structmember.h" /* Why is this not included in Python.h? */
 
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 60660ad..8f9d4e7 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -111,10 +111,11 @@
 #define PyDict_MINSIZE 8
 
 #include "Python.h"
+#include "pycore_gc.h"       // _PyObject_GC_IS_TRACKED()
 #include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"  // _PyThreadState_GET()
 #include "dict-common.h"
-#include "stringlib/eq.h"    /* to get unicode_eq() */
+#include "stringlib/eq.h"    // unicode_eq()
 
 /*[clinic input]
 class dict "PyDictObject *" "&PyDict_Type"
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index dad177a..cb661f8 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -9,7 +9,6 @@
 #include "pycore_initconfig.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 #include "structmember.h"
 #include "osdefs.h"
 
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index b8ec56e..1c6ecaf 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -2,7 +2,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_runtime.h"  // _PyRuntime
 
 #if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
 /* clang MemorySanitizer doesn't yet understand getc_unlocked. */
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 340267b..3c140ac 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -2,7 +2,7 @@
 
 #include "Python.h"
 #include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_gc.h"       // _PyObject_GC_IS_TRACKED()
 
 #include "code.h"
 #include "frameobject.h"
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 3ec949d..af6766f 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -4,7 +4,6 @@
 #include "Python.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 #include "pycore_tupleobject.h"
 #include "code.h"
 #include "structmember.h"
diff --git a/Objects/genobject.c b/Objects/genobject.c
index d3455f8..b1a749d 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1,9 +1,9 @@
 /* Generator object implementation */
 
 #include "Python.h"
-#include "pycore_ceval.h"   /* _PyEval_EvalFrame() */
+#include "pycore_ceval.h"     // _PyEval_EvalFrame()
 #include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyThreadState_GET()
 #include "frameobject.h"
 #include "structmember.h"
 #include "opcode.h"
diff --git a/Objects/interpreteridobject.c b/Objects/interpreteridobject.c
index 84fd858..a250293 100644
--- a/Objects/interpreteridobject.c
+++ b/Objects/interpreteridobject.c
@@ -3,7 +3,6 @@
 #include "Python.h"
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_interp.h"     // _PyInterpreterState_LookUpID()
-#include "pycore_pystate.h"
 #include "interpreteridobject.h"
 
 
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index fe1de7e..51104fb 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -3,7 +3,6 @@
 #include "Python.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 
 typedef struct {
     PyObject_HEAD
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 7058fe4..7d2f006 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -3,7 +3,6 @@
 #include "Python.h"
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_object.h"
-#include "pycore_pystate.h"
 #include "pycore_tupleobject.h"
 #include "pycore_accu.h"
 
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index da06338..4340f06 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -14,7 +14,6 @@
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 #include "pystrhex.h"
 #include <stddef.h>
 
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 44ae00f..4b4927d 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -2,11 +2,11 @@
 /* Method object implementation */
 
 #include "Python.h"
-#include "pycore_ceval.h"   // _Py_EnterRecursiveCall()
+#include "pycore_ceval.h"     // _Py_EnterRecursiveCall()
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyThreadState_GET()
 #include "structmember.h"
 
 /* undefine macro trampoline to PyCFunction_NewEx */
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 1f419ad..499ce09a 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -3,7 +3,7 @@
 
 #include "Python.h"
 #include "pycore_interp.h"    // PyInterpreterState.importlib
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyInterpreterState_GET()
 #include "structmember.h"
 
 static Py_ssize_t max_module_number;
diff --git a/Objects/object.c b/Objects/object.c
index ef4ba99..4fa488e 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -2,13 +2,13 @@
 /* Generic object operations; and implementation of None */
 
 #include "Python.h"
-#include "pycore_ceval.h"   // _Py_EnterRecursiveCall()
+#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
 #include "pycore_context.h"
 #include "pycore_initconfig.h"
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "frameobject.h"
 #include "interpreteridobject.h"
 
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 220ae92..2fcaa47 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -466,7 +466,6 @@
 
 #include "Python.h"
 #include "pycore_object.h"
-#include "pycore_pystate.h"
 #include "structmember.h"
 #include "dict-common.h"
 #include <stddef.h>
@@ -890,7 +889,7 @@
     if (mutablemapping_update_arg(self, other) < 0) {
         return NULL;
     }
-    Py_INCREF(self); 
+    Py_INCREF(self);
     return self;
 }
 
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 232ba6d..0b15bed 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -32,8 +32,7 @@
 */
 
 #include "Python.h"
-#include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_object.h"   // _PyObject_GC_UNTRACK()
 #include "structmember.h"
 
 /* Object used as dummy key to fill deleted entries */
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 4fd2163..0a5f00d 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -17,7 +17,6 @@
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 #include "structmember.h"
 
 static PyObject *
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 110c092..b65b8ab 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -3,9 +3,9 @@
 
 #include "Python.h"
 #include "pycore_abstract.h"   // _PyIndex_Check()
-#include "pycore_object.h"
-#include "pycore_pystate.h"
 #include "pycore_accu.h"
+#include "pycore_gc.h"         // _PyObject_GC_IS_TRACKED()
+#include "pycore_object.h"
 
 /*[clinic input]
 class tuple "PyTupleObject *" "&PyTuple_Type"
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 209c6a5..47766bf 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5,7 +5,7 @@
 #include "pycore_initconfig.h"
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"     // _PyThreadState_GET()
 #include "frameobject.h"
 #include "structmember.h"
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 28ec8f1..51775df 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -40,14 +40,15 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
+#include "pycore_abstract.h"       // _PyIndex_Check()
 #include "pycore_bytes_methods.h"
 #include "pycore_fileutils.h"
 #include "pycore_initconfig.h"
+#include "pycore_interp.h"         // PyInterpreterState.fs_codec
 #include "pycore_object.h"
 #include "pycore_pathconfig.h"
 #include "pycore_pylifecycle.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"        // _PyInterpreterState_GET()
 #include "ucnhash.h"
 #include "stringlib/eq.h"
 
diff --git a/PC/getpathp.c b/PC/getpathp.c
index aa820e5..24a9323 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -82,7 +82,6 @@
 #include "Python.h"
 #include "pycore_initconfig.h"   /* PyStatus */
 #include "pycore_pathconfig.h"   /* _PyPathConfig */
-#include "pycore_pystate.h"
 #include "osdefs.h"
 #include <wchar.h>
 
diff --git a/Parser/listnode.c b/Parser/listnode.c
index 3bcc03e..c806b98 100644
--- a/Parser/listnode.c
+++ b/Parser/listnode.c
@@ -2,8 +2,8 @@
 /* List a node on a file */
 
 #include "Python.h"
-#include "pycore_interp.h"   // PyInterpreterState.parser
-#include "pycore_pystate.h"  // _PyInterpreterState_GET
+#include "pycore_interp.h"        // PyInterpreterState.parser
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "token.h"
 #include "node.h"
 
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 43e5583..7da8ea8 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -10,10 +10,10 @@
 */
 
 #include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyThreadState_GET()
 #ifdef MS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
+#  define WIN32_LEAN_AND_MEAN
+#  include "windows.h"
 #endif /* MS_WINDOWS */
 
 
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 900a4b1..da3e786 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -6,8 +6,8 @@
 #undef NDEBUG
 
 #include <Python.h>
-#include "pycore_initconfig.h"   /* _PyConfig_InitCompatConfig() */
-#include "pycore_pystate.h"      /* _PyRuntime */
+#include "pycore_initconfig.h"    // _PyConfig_InitCompatConfig()
+#include "pycore_runtime.h"       // _PyRuntime
 #include <Python.h>
 #include "pythread.h"
 #include <inttypes.h>
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 0236cab..f4ef0bb 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -2,7 +2,7 @@
 #include "pycore_initconfig.h"
 #include "pycore_interp.h"        // PyInterpreterState.warnings
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "frameobject.h"
 #include "clinic/_warnings.c.h"
 
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8063c21..a9fc21f 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -6,7 +6,7 @@
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
 
 _Py_IDENTIFIER(__builtins__);
diff --git a/Python/ceval.c b/Python/ceval.c
index fc720b4..16e2d0b 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -10,7 +10,7 @@
 #define PY_LOCAL_AGGRESSIVE
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
+#include "pycore_abstract.h"     // _PyIndex_Check()
 #include "pycore_call.h"
 #include "pycore_ceval.h"
 #include "pycore_code.h"
@@ -18,7 +18,7 @@
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"      // _PyInterpreterState_GET()
 #include "pycore_sysmodule.h"
 #include "pycore_tupleobject.h"
 
diff --git a/Python/codecs.c b/Python/codecs.c
index 32cc110..0f18c27 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -9,8 +9,8 @@
    ------------------------------------------------------------------------ */
 
 #include "Python.h"
-#include "pycore_interp.h"     // PyInterpreterState.codec_search_path
-#include "pycore_pystate.h"
+#include "pycore_interp.h"        // PyInterpreterState.codec_search_path
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "ucnhash.h"
 #include <ctype.h>
 
diff --git a/Python/context.c b/Python/context.c
index e0338c9..00f25dd 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -1,10 +1,11 @@
 #include "Python.h"
 
 #include "pycore_context.h"
+#include "pycore_gc.h"            // _PyObject_GC_MAY_BE_TRACKED()
 #include "pycore_hamt.h"
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "structmember.h"
 
 
diff --git a/Python/errors.c b/Python/errors.c
index a2fe52b..db00770 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -4,7 +4,7 @@
 #include "Python.h"
 #include "pycore_initconfig.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"    // _PyThreadState_GET()
 #include "pycore_sysmodule.h"
 #include "pycore_traceback.h"
 
diff --git a/Python/frozenmain.c b/Python/frozenmain.c
index 508721b..dd04d60 100644
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -2,7 +2,7 @@
 /* Python interpreter main program for frozen scripts */
 
 #include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_runtime.h"  // _PyRuntime_Initialize()
 #include <locale.h>
 
 #ifdef MS_WINDOWS
diff --git a/Python/hamt.c b/Python/hamt.c
index 7299810..9924e33 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -1,8 +1,7 @@
 #include "Python.h"
 
 #include "pycore_hamt.h"
-#include "pycore_object.h"
-#include "pycore_pystate.h"
+#include "pycore_object.h"   // _PyObject_GC_TRACK()
 #include "structmember.h"
 
 /*
diff --git a/Python/import.c b/Python/import.c
index 042691d..8a2f9de 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -9,8 +9,8 @@
 #include "pycore_pyhash.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
-#include "pycore_interp.h"       // _PyInterpreterState_ClearModules()
-#include "pycore_pystate.h"
+#include "pycore_interp.h"        // _PyInterpreterState_ClearModules()
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_sysmodule.h"
 #include "errcode.h"
 #include "marshal.h"
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 43e0ccb..201d930 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -1,25 +1,25 @@
 #include "Python.h"
-#include "osdefs.h"       /* DELIM */
+#include "osdefs.h"               // DELIM
 #include "pycore_fileutils.h"
 #include "pycore_getopt.h"
 #include "pycore_initconfig.h"
-#include "pycore_interp.h"    // _PyInterpreterState.runtime
+#include "pycore_interp.h"        // _PyInterpreterState.runtime
 #include "pycore_pathconfig.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"   /* _PyRuntime */
-#include <locale.h>       /* setlocale() */
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include <locale.h>               // setlocale()
 #ifdef HAVE_LANGINFO_H
-#  include <langinfo.h>   /* nl_langinfo(CODESET) */
+#  include <langinfo.h>           // nl_langinfo(CODESET)
 #endif
 #if defined(MS_WINDOWS) || defined(__CYGWIN__)
-#  include <windows.h>    /* GetACP() */
+#  include <windows.h>            // GetACP()
 #  ifdef HAVE_IO_H
 #    include <io.h>
 #  endif
 #  ifdef HAVE_FCNTL_H
-#    include <fcntl.h>    /* O_BINARY */
+#    include <fcntl.h>            // O_BINARY
 #  endif
 #endif
 
diff --git a/Python/pathconfig.c b/Python/pathconfig.c
index aa1d6f8..1515926 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -6,8 +6,10 @@
 #include "pycore_fileutils.h"
 #include "pycore_pathconfig.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
 #include <wchar.h>
+#ifdef MS_WINDOWS
+#  include <windows.h>            // GetFullPathNameW(), MAX_PATH
+#endif
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/Python/preconfig.c b/Python/preconfig.c
index db32875..531d8d0 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -2,7 +2,7 @@
 #include "pycore_getopt.h"
 #include "pycore_initconfig.h"
 #include "pycore_pymem.h"      // _PyMem_GetAllocatorName()
-#include "pycore_pystate.h"    // _PyRuntime_Initialize()
+#include "pycore_runtime.h"    // _PyRuntime_Initialize()
 #include <locale.h>            // setlocale()
 
 
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index ac0ea10..754e762 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -6,7 +6,7 @@
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
 #include "pycore_ceval.h"
 #include "pycore_context.h"
-#include "pycore_import.h"   /* _PyImport_FindBuiltin */
+#include "pycore_import.h"        // _PyImport_Cleanup()
 #include "pycore_initconfig.h"
 #include "pycore_fileutils.h"
 #include "pycore_hamt.h"
@@ -15,7 +15,7 @@
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_sysmodule.h"
 #include "pycore_traceback.h"
 #include "grammar.h"
diff --git a/Python/pystate.c b/Python/pystate.c
index 65d46a2..3c427c1 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -7,7 +7,7 @@
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_sysmodule.h"
 
 /* --------------------------------------------------------------------------
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index d1165e2..2466699 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -12,10 +12,11 @@
 
 #include "Python-ast.h"
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
+#include "pycore_interp.h"        // PyInterpreterState.importlib
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_sysmodule.h"
 #include "grammar.h"
 #include "node.h"
diff --git a/Python/symtable.c b/Python/symtable.c
index 014570e..a3c5d65 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyThreadState_GET()
 #include "symtable.h"
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
 #include "structmember.h"
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 6b3a1c3..79e5df0 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -18,13 +18,12 @@
 #include "code.h"
 #include "frameobject.h"
 #include "pycore_ceval.h"        // _Py_RecursionLimitLowerWaterMark()
-#include "pycore_pystate.h"      // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
 #include "pycore_initconfig.h"
 #include "pycore_pathconfig.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"
+#include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
 #include "pythread.h"
 #include "pydtrace.h"
diff --git a/Python/thread.c b/Python/thread.c
index bac0e69..1276103 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -6,7 +6,7 @@
    Stuff shared by all thread_*.h files is collected here. */
 
 #include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_pystate.h"   // _PyInterpreterState_GET()
 
 #ifndef _POSIX_THREADS
 /* This means pthreads are not implemented in libc headers, hence the macro
diff --git a/Python/traceback.c b/Python/traceback.c
index 2167e07..610c217 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -2,7 +2,6 @@
 /* Traceback implementation */
 
 #include "Python.h"
-#include "pycore_pystate.h"
 
 #include "code.h"
 #include "frameobject.h"