From e5014be0497d06d78343623588a80f491a6f7b74 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 14 Apr 2020 17:52:15 +0200 Subject: [PATCH] bpo-40268: Remove a few pycore_pystate.h includes (GH-19510) --- Modules/_functoolsmodule.c | 2 +- Modules/_io/bufferedio.c | 1 - Modules/_io/textio.c | 3 ++- Modules/_threadmodule.c | 2 +- Modules/gcmodule.c | 7 ++++--- Modules/getpath.c | 5 ++--- Modules/main.c | 2 +- Modules/posixmodule.c | 2 +- Modules/signalmodule.c | 2 +- Objects/abstract.c | 2 +- Objects/call.c | 4 ++-- Objects/cellobject.c | 1 - Objects/classobject.c | 2 +- Objects/descrobject.c | 4 ++-- Objects/dictobject.c | 5 +++-- Objects/exceptions.c | 1 - Objects/fileobject.c | 2 +- Objects/frameobject.c | 2 +- Objects/funcobject.c | 1 - Objects/genobject.c | 4 ++-- Objects/interpreteridobject.c | 1 - Objects/iterobject.c | 1 - Objects/listobject.c | 1 - Objects/memoryobject.c | 1 - Objects/methodobject.c | 4 ++-- Objects/moduleobject.c | 2 +- Objects/object.c | 4 ++-- Objects/odictobject.c | 3 +-- Objects/setobject.c | 3 +-- Objects/sliceobject.c | 1 - Objects/tupleobject.c | 4 ++-- Objects/typeobject.c | 2 +- Objects/unicodeobject.c | 5 +++-- PC/getpathp.c | 1 - Parser/listnode.c | 4 ++-- Parser/myreadline.c | 6 +++--- Programs/_testembed.c | 4 ++-- Python/_warnings.c | 2 +- Python/bltinmodule.c | 2 +- Python/ceval.c | 4 ++-- Python/codecs.c | 4 ++-- Python/context.c | 3 ++- Python/errors.c | 2 +- Python/frozenmain.c | 2 +- Python/hamt.c | 3 +-- Python/import.c | 4 ++-- Python/initconfig.c | 14 +++++++------- Python/pathconfig.c | 4 +++- Python/preconfig.c | 2 +- Python/pylifecycle.c | 4 ++-- Python/pystate.c | 2 +- Python/pythonrun.c | 3 ++- Python/symtable.c | 2 +- Python/sysmodule.c | 3 +-- Python/thread.c | 2 +- Python/traceback.c | 1 - 56 files changed, 78 insertions(+), 86 deletions(-) diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 2f1b47a5b06..d9536bb4e92 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 6e76db42c3a..4ec42eb0108 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 95b023d1790..9e33c1ed17b 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 5636140dde4..8ff06698a80 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 // offsetof() diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 17541824761..281ab33e065 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 e97ea8b3079..1dd8dd0134e 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 #include diff --git a/Modules/main.c b/Modules/main.c index fb24c6c6c28..fa9c6b4eb94 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 /* perror() */ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 2d603d14e8d..692dda314b3 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 ceb986bddcb..69d69ace28e 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 7e1e51b4c87..8e22dfeca99 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 #include "structmember.h" /* we need the offsetof() macro from there */ #include "longintrepr.h" diff --git a/Objects/call.c b/Objects/call.c index 08614143246..61426c7e09e 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 e97feefbf6d..6efae626bf5 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 999b91c0a2d..ce4bf7b5ff9 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 5fab222b82c..fe7ba79770a 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 60660adf897..8f9d4e7b731 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -111,10 +111,11 @@ converting the dict to the combined table. #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 dad177a1ab6..cb661f84ff2 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 b8ec56e994c..1c6ecaf82c2 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 340267bd479..3c140acad7e 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 3ec949d573b..af6766fbd7a 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 d3455f8dcd7..b1a749d140e 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 84fd8584520..a250293a472 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 fe1de7e211c..51104fbe969 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 7058fe4396e..7d2f006617b 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 da06338017c..4340f0675f1 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 diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 44ae00f7e00..4b4927db820 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 1f419ad0831..499ce09ae6b 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 ef4ba997de4..4fa488e8d08 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 220ae92ec92..2fcaa478765 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -466,7 +466,6 @@ Potential Optimizations #include "Python.h" #include "pycore_object.h" -#include "pycore_pystate.h" #include "structmember.h" #include "dict-common.h" #include @@ -890,7 +889,7 @@ odict_inplace_or(PyObject *self, PyObject *other) 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 232ba6d97a0..0b15bedeb4f 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 4fd216388fd..0a5f00dbe0a 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -17,7 +17,6 @@ this type and there is exactly one in existence. #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 110c0925ccd..b65b8abc280 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 209c6a554ee..47766bf6fbb 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 28ec8f10dcb..51775df199d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -40,14 +40,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #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 aa820e57a9c..24a9323e6e6 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 diff --git a/Parser/listnode.c b/Parser/listnode.c index 3bcc03e9352..c806b98e48c 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 43e5583b8bc..7da8ea83780 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 900a4b1d427..da3e7861d1e 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -6,8 +6,8 @@ #undef NDEBUG #include -#include "pycore_initconfig.h" /* _PyConfig_InitCompatConfig() */ -#include "pycore_pystate.h" /* _PyRuntime */ +#include "pycore_initconfig.h" // _PyConfig_InitCompatConfig() +#include "pycore_runtime.h" // _PyRuntime #include #include "pythread.h" #include diff --git a/Python/_warnings.c b/Python/_warnings.c index 0236cabdf11..f4ef0bb4b12 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 8063c2186d3..a9fc21f1087 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -6,7 +6,7 @@ #undef Yield /* undefine macro conflicting with */ #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 fc720b4ba40..16e2d0b1fbe 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 32cc110d8ec..0f18c27e5fe 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -9,8 +9,8 @@ Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ #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 diff --git a/Python/context.c b/Python/context.c index e0338c97e18..00f25ddab41 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 a2fe52b8120..db007709d26 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 508721b8559..dd04d609d24 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 #ifdef MS_WINDOWS diff --git a/Python/hamt.c b/Python/hamt.c index 729981033f4..9924e335124 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 042691d30b0..8a2f9de066a 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 43e0ccb09b7..201d930f7d8 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 /* setlocale() */ +#include "pycore_pystate.h" // _PyThreadState_GET() +#include // setlocale() #ifdef HAVE_LANGINFO_H -# include /* nl_langinfo(CODESET) */ +# include // nl_langinfo(CODESET) #endif #if defined(MS_WINDOWS) || defined(__CYGWIN__) -# include /* GetACP() */ +# include // GetACP() # ifdef HAVE_IO_H # include # endif # ifdef HAVE_FCNTL_H -# include /* O_BINARY */ +# include // O_BINARY # endif #endif diff --git a/Python/pathconfig.c b/Python/pathconfig.c index aa1d6f8139b..1515926531a 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 +#ifdef MS_WINDOWS +# include // GetFullPathNameW(), MAX_PATH +#endif #ifdef __cplusplus extern "C" { diff --git a/Python/preconfig.c b/Python/preconfig.c index db328759c13..531d8d0df35 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 // setlocale() diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index ac0ea107bcf..754e7620a0c 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -6,7 +6,7 @@ #undef Yield /* undefine macro conflicting with */ #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 65d46a2bb42..3c427c12107 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 d1165e2b4d2..246669994c4 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -12,10 +12,11 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with */ +#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 014570e6ef7..a3c5d650d1e 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 */ #include "structmember.h" diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 6b3a1c38b9d..79e5df06d30 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -18,13 +18,12 @@ Data members: #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 bac0e6992ae..12761031866 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 2167e07a9b8..610c2172ef8 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"