From ff806602a54a60b3cba7155b6dda683b2210477f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 19 Mar 2025 23:22:11 +0100 Subject: [PATCH 1/2] gh-131238: Use pycore_interp_structs.h header Replace pycore_runtime_structs.h include with pycore_interp_structs.h include in internal headers. --- Include/internal/pycore_codecs.h | 2 +- Include/internal/pycore_fileutils.h | 2 +- Include/internal/pycore_gc.h | 3 +-- Include/internal/pycore_import.h | 4 ++-- Include/internal/pycore_interp.h | 3 --- Include/internal/pycore_runtime.h | 3 ++- Include/internal/pycore_time.h | 2 +- Include/internal/pycore_typeobject.h | 2 +- 8 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Include/internal/pycore_codecs.h b/Include/internal/pycore_codecs.h index 7c44a449270202..01b31d31998e53 100644 --- a/Include/internal/pycore_codecs.h +++ b/Include/internal/pycore_codecs.h @@ -8,8 +8,8 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif +#include "pycore_interp_structs.h" // struct codecs_state #include "pycore_lock.h" // PyMutex -#include "pycore_runtime_structs.h" // struct codecs_state /* Initialize codecs-related state for the given interpreter, including registering the first codec search function. Must be called before any other diff --git a/Include/internal/pycore_fileutils.h b/Include/internal/pycore_fileutils.h index 1ef23588d85527..2c6d6daa01994e 100644 --- a/Include/internal/pycore_fileutils.h +++ b/Include/internal/pycore_fileutils.h @@ -9,7 +9,7 @@ extern "C" { #endif #include // struct lconv -#include "pycore_runtime_structs.h" // _Py_error_handler +#include "pycore_interp_structs.h" // _Py_error_handler /* A routine to check if a file descriptor can be select()-ed. */ diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h index c33b98cdc43fb4..2fd58e657bf3ed 100644 --- a/Include/internal/pycore_gc.h +++ b/Include/internal/pycore_gc.h @@ -8,8 +8,7 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_pystate.h" -#include "pycore_runtime_structs.h" +#include "pycore_interp_structs.h" // PyGC_Head #include "pycore_typedefs.h" // _PyInterpreterFrame diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h index 2b68228f8c6470..f99ab59140f0dc 100644 --- a/Include/internal/pycore_import.h +++ b/Include/internal/pycore_import.h @@ -9,9 +9,9 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_lock.h" // PyMutex -#include "pycore_runtime_structs.h" // _import_state #include "pycore_hashtable.h" // _Py_hashtable_t +#include "pycore_interp_structs.h" // _import_state +#include "pycore_lock.h" // PyMutex extern int _PyImport_IsInitialized(PyInterpreterState *); diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index eb8ed2ec6ac2c7..49eedd8d2a2332 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -8,9 +8,6 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include // bool - -#include "pycore_runtime_structs.h" #include "pycore_genobject.h" // _PyGen_FetchStopIterationValue diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index bda8a30dd1d0ad..7fc7f343fe600f 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -8,7 +8,8 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_runtime_structs.h" +#include "pycore_runtime_structs.h" // _PyRuntimeState + /* API */ diff --git a/Include/internal/pycore_time.h b/Include/internal/pycore_time.h index f50c43d8e552b5..23312471c6584e 100644 --- a/Include/internal/pycore_time.h +++ b/Include/internal/pycore_time.h @@ -57,7 +57,7 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_runtime_structs.h" +#include "pycore_runtime_structs.h" // _PyTimeFraction #ifdef __clang__ struct timeval; diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index a5bea7116ba807..cd36400c0d3e95 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -9,8 +9,8 @@ extern "C" { #endif #include "pycore_function.h" +#include "pycore_interp_structs.h" // managed_static_type_state #include "pycore_moduleobject.h" // PyModuleObject -#include "pycore_runtime_structs.h" // type state #include "pycore_stats.h" From 01ae38a78f125bcafbc07e7e9755a5c79b363b0c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 19 Mar 2025 23:47:19 +0100 Subject: [PATCH 2/2] Add missing include --- Include/internal/pycore_gc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h index 2fd58e657bf3ed..96b3bc2e6333bc 100644 --- a/Include/internal/pycore_gc.h +++ b/Include/internal/pycore_gc.h @@ -9,6 +9,7 @@ extern "C" { #endif #include "pycore_interp_structs.h" // PyGC_Head +#include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_typedefs.h" // _PyInterpreterFrame