https://github.com/python/cpython/commit/22706843e0211a42a0e1b9e3b3b2527e9c2f546b
commit: 22706843e0211a42a0e1b9e3b3b2527e9c2f546b
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-19T17:46:24Z
summary:

gh-131238: Remove many includes from pycore_interp.h (#131472)

files:
M Include/internal/pycore_interp.h
M Include/internal/pycore_runtime_init.h
M Objects/abstract.c
M Objects/exceptions.c
M Objects/object.c
M Objects/tupleobject.c
M Objects/unicodeobject.c
M Python/ceval.c
M Python/gc.c
M Python/gc_free_threading.c
M Python/instrumentation.c
M Python/pystate.c

diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 740b0c7ec46093..28ec42377ad8cc 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -11,32 +11,12 @@ extern "C" {
 #include <stdbool.h>              // bool
 
 #include "pycore_runtime_structs.h"
-#include "pycore_ceval_state.h"   // struct _ceval_state
 #include "pycore_code.h"          // struct callable_cache
-#include "pycore_codecs.h"        // struct codecs_state
-#include "pycore_context.h"       // struct _Py_context_state
-#include "pycore_crossinterp.h"   // _PyXI_state_t
-#include "pycore_dict_state.h"    // struct _Py_dict_state
-#include "pycore_dtoa.h"          // struct _dtoa_state
-#include "pycore_exceptions.h"    // struct _Py_exc_state
 #include "pycore_floatobject.h"   // struct _Py_float_state
-#include "pycore_function.h"      // FUNC_MAX_WATCHERS
 #include "pycore_gc.h"            // struct _gc_runtime_state
 #include "pycore_genobject.h"     // _PyGen_FetchStopIterationValue
-#include "pycore_global_objects.h"// struct _Py_interp_cached_objects
 #include "pycore_import.h"        // struct _import_state
-#include "pycore_index_pool.h"     // _PyIndexPool
-#include "pycore_instruments.h"   // _PY_MONITORING_EVENTS
-#include "pycore_list.h"          // struct _Py_list_state
-#include "pycore_mimalloc.h"      // struct _mimalloc_interp_state
-#include "pycore_object_state.h"  // struct _py_object_state
 #include "pycore_optimizer.h"     // _PyExecutorObject
-#include "pycore_obmalloc.h"      // struct _obmalloc_state
-#include "pycore_qsbr.h"          // struct _qsbr_state
-#include "pycore_stackref.h"      // Py_STACKREF_DEBUG
-#include "pycore_tstate.h"        // _PyThreadStateImpl
-#include "pycore_tuple.h"         // struct _Py_tuple_state
-#include "pycore_uniqueid.h"      // struct _Py_unique_id_pool
 #include "pycore_typeobject.h"    // struct types_state
 #include "pycore_unicodeobject.h" // struct _Py_unicode_state
 #include "pycore_warnings.h"      // struct _warnings_runtime_state
diff --git a/Include/internal/pycore_runtime_init.h 
b/Include/internal/pycore_runtime_init.h
index 5ea9b296feba75..497599f6717e76 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -11,6 +11,7 @@ extern "C" {
 #include "pycore_structs.h"
 #include "pycore_ceval_state.h"   // _PyEval_RUNTIME_PERF_INIT
 #include "pycore_debug_offsets.h"  // _Py_DebugOffsets_INIT()
+#include "pycore_dtoa.h"          // _dtoa_state_INIT()
 #include "pycore_faulthandler.h"  // _faulthandler_runtime_state_INIT
 #include "pycore_floatobject.h"   // _py_float_format_unknown
 #include "pycore_function.h"
diff --git a/Objects/abstract.c b/Objects/abstract.c
index db7b9263711f68..ce006777e5c1dd 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2,14 +2,16 @@
 
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
-#include "pycore_pybuffer.h"
 #include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _Py_EnterRecursiveCallTstate()
 #include "pycore_crossinterp.h"   // _Py_CallInInterpreter()
-#include "pycore_object.h"        // _Py_CheckSlotResult()
+#include "pycore_list.h"          // _PyList_AppendTakeRef()
 #include "pycore_long.h"          // _Py_IsNegative
+#include "pycore_object.h"        // _Py_CheckSlotResult()
+#include "pycore_pybuffer.h"
 #include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_tuple.h"         // _PyTuple_FromArraySteal()
 #include "pycore_unionobject.h"   // _PyUnion_Check()
 
 #include <stddef.h>               // offsetof()
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index e30fea0f37a925..942b0c630e33f0 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -13,11 +13,12 @@
 #include "pycore_modsupport.h"    // _PyArg_NoKeywords()
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"      // struct _PyErr_SetRaisedException
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
 
 #include "osdefs.h"               // SEP
-
 #include "clinic/exceptions.c.h"
 
+
 /*[clinic input]
 class BaseException "PyBaseExceptionObject *" "&PyExc_BaseException"
 class BaseExceptionGroup "PyBaseExceptionGroupObject *" 
"&PyExc_BaseExceptionGroup"
diff --git a/Objects/object.c b/Objects/object.c
index c8f3831d6f3b82..4eff24bc3a9507 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -11,20 +11,22 @@
 #include "pycore_dict.h"          // _PyObject_MakeDictFromInstanceAttributes()
 #include "pycore_floatobject.h"   // _PyFloat_DebugMallocStats()
 #include "pycore_freelist.h"      // _PyObject_ClearFreeLists()
+#include "pycore_hamt.h"          // _PyHamtItems_Type
+#include "pycore_hashtable.h"     // _Py_hashtable_new()
 #include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
 #include "pycore_instruction_sequence.h" // _PyInstructionSequence_Type
-#include "pycore_hashtable.h"     // _Py_hashtable_new()
-#include "pycore_hamt.h"          // _PyHamtItems_Type
+#include "pycore_list.h"          // _PyList_DebugMallocStats()
+#include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_memoryobject.h"  // _PyManagedBuffer_Type
 #include "pycore_namespace.h"     // _PyNamespace_Type
 #include "pycore_object.h"        // PyAPI_DATA() _Py_SwappedOp definition
 #include "pycore_object_state.h"  // struct _reftracer_runtime_state
-#include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_optimizer.h"     // _PyUOpExecutor_Type, ...
 #include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_symtable.h"      // PySTEntry_Type
+#include "pycore_tuple.h"         // _PyTuple_DebugMallocStats()
 #include "pycore_typeobject.h"    // _PyBufferWrapper_Type
 #include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
 #include "pycore_unionobject.h"   // _PyUnion_Type
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 1b2b53646da6d9..ede8fd219c4cf0 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -7,8 +7,10 @@
 #include "pycore_freelist.h"      // _Py_FREELIST_PUSH(), _Py_FREELIST_POP()
 #include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
 #include "pycore_initconfig.h"    // _PyStatus_OK()
+#include "pycore_list.h"          // _Py_memory_repeat()
 #include "pycore_modsupport.h"    // _PyArg_NoKwnames()
 #include "pycore_object.h"        // _PyObject_GC_TRACK(), 
_Py_FatalRefcountError(), _PyDebugAllocatorStats()
+#include "pycore_tuple.h"         // _PyTupleIterObject
 
 /*[clinic input]
 class tuple "PyTupleObject *" "&PyTuple_Type"
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7a8ac322197b0e..3e0bd90c17995f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -56,6 +56,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
SOFTWARE.
 #include "pycore_pyhash.h"        // _Py_HashSecret_t
 #include "pycore_pylifecycle.h"   // _Py_SetFileSystemEncoding()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
 #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
 #include "pycore_unicodeobject.h" // struct _Py_unicode_state
 #include "pycore_unicodeobject_generated.h"  // _PyUnicode_InitStaticStrings()
diff --git a/Python/ceval.c b/Python/ceval.c
index 1720fff104030d..7248e0bbc0e1bd 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -15,6 +15,7 @@
 #include "pycore_instruments.h"
 #include "pycore_intrinsics.h"
 #include "pycore_jit.h"
+#include "pycore_list.h"          // _PyList_GetItemRef()
 #include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_moduleobject.h"  // PyModuleObject
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
diff --git a/Python/gc.c b/Python/gc.c
index f2a88657e8d8d6..ff0fa636bd68f8 100644
--- a/Python/gc.c
+++ b/Python/gc.c
@@ -12,7 +12,9 @@
 #include "pycore_object_alloc.h"  // _PyObject_MallocWithType()
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_tuple.h"         // _PyTuple_MaybeUntrack()
 #include "pycore_weakref.h"       // _PyWeakref_ClearRef()
+
 #include "pydtrace.h"
 
 #ifndef Py_GIL_DISABLED
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c
index 36b6eca1eddfb3..713a48744df3a1 100644
--- a/Python/gc_free_threading.c
+++ b/Python/gc_free_threading.c
@@ -10,6 +10,7 @@
 #include "pycore_object_alloc.h"  // _PyObject_MallocWithType()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_tstate.h"        // _PyThreadStateImpl
+#include "pycore_tuple.h"         // _PyTuple_MaybeUntrack()
 #include "pycore_weakref.h"       // _PyWeakref_ClearRef()
 
 #include "pydtrace.h"
diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index 299066d9c206b6..56035d6ae5a598 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -1,7 +1,4 @@
 #include "Python.h"
-
-#include "opcode_ids.h"
-
 #include "pycore_bitutils.h"      // _Py_popcount32
 #include "pycore_call.h"
 #include "pycore_ceval.h"         // _PY_EVAL_EVENTS_BITS
@@ -18,7 +15,11 @@
 #include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_UINTPTR_RELEASE
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "pycore_runtime_structs.h"     // _PyCoMonitoringData
+#include "pycore_runtime_structs.h"  // _PyCoMonitoringData
+#include "pycore_tuple.h"         // _PyTuple_FromArraySteal()
+
+#include "opcode_ids.h"
+
 
 /* Uncomment this to dump debugging output when assertions fail */
 // #define INSTRUMENT_DEBUG 1
diff --git a/Python/pystate.c b/Python/pystate.c
index 68a7426a2601d3..3aec10219b0382 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -8,6 +8,7 @@
 #include "pycore_audit.h"         // _Py_AuditHookEntry
 #include "pycore_ceval.h"
 #include "pycore_code.h"          // stats
+#include "pycore_codecs.h"        // _PyCodec_Fini()
 #include "pycore_critical_section.h"       // _PyCriticalSection_Resume()
 #include "pycore_dtoa.h"          // _dtoa_state_INIT()
 #include "pycore_emscripten_trampoline.h"  // _Py_EmscriptenTrampoline_Init()

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to