Skip to content

Commit 2270684

Browse files
authored
gh-131238: Remove many includes from pycore_interp.h (#131472)
1 parent a4832f6 commit 2270684

12 files changed

+25
-30
lines changed

Include/internal/pycore_interp.h

-20
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,12 @@ extern "C" {
1111
#include <stdbool.h> // bool
1212

1313
#include "pycore_runtime_structs.h"
14-
#include "pycore_ceval_state.h" // struct _ceval_state
1514
#include "pycore_code.h" // struct callable_cache
16-
#include "pycore_codecs.h" // struct codecs_state
17-
#include "pycore_context.h" // struct _Py_context_state
18-
#include "pycore_crossinterp.h" // _PyXI_state_t
19-
#include "pycore_dict_state.h" // struct _Py_dict_state
20-
#include "pycore_dtoa.h" // struct _dtoa_state
21-
#include "pycore_exceptions.h" // struct _Py_exc_state
2215
#include "pycore_floatobject.h" // struct _Py_float_state
23-
#include "pycore_function.h" // FUNC_MAX_WATCHERS
2416
#include "pycore_gc.h" // struct _gc_runtime_state
2517
#include "pycore_genobject.h" // _PyGen_FetchStopIterationValue
26-
#include "pycore_global_objects.h"// struct _Py_interp_cached_objects
2718
#include "pycore_import.h" // struct _import_state
28-
#include "pycore_index_pool.h" // _PyIndexPool
29-
#include "pycore_instruments.h" // _PY_MONITORING_EVENTS
30-
#include "pycore_list.h" // struct _Py_list_state
31-
#include "pycore_mimalloc.h" // struct _mimalloc_interp_state
32-
#include "pycore_object_state.h" // struct _py_object_state
3319
#include "pycore_optimizer.h" // _PyExecutorObject
34-
#include "pycore_obmalloc.h" // struct _obmalloc_state
35-
#include "pycore_qsbr.h" // struct _qsbr_state
36-
#include "pycore_stackref.h" // Py_STACKREF_DEBUG
37-
#include "pycore_tstate.h" // _PyThreadStateImpl
38-
#include "pycore_tuple.h" // struct _Py_tuple_state
39-
#include "pycore_uniqueid.h" // struct _Py_unique_id_pool
4020
#include "pycore_typeobject.h" // struct types_state
4121
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
4222
#include "pycore_warnings.h" // struct _warnings_runtime_state

Include/internal/pycore_runtime_init.h

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern "C" {
1111
#include "pycore_structs.h"
1212
#include "pycore_ceval_state.h" // _PyEval_RUNTIME_PERF_INIT
1313
#include "pycore_debug_offsets.h" // _Py_DebugOffsets_INIT()
14+
#include "pycore_dtoa.h" // _dtoa_state_INIT()
1415
#include "pycore_faulthandler.h" // _faulthandler_runtime_state_INIT
1516
#include "pycore_floatobject.h" // _py_float_format_unknown
1617
#include "pycore_function.h"

Objects/abstract.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
#include "Python.h"
44
#include "pycore_abstract.h" // _PyIndex_Check()
5-
#include "pycore_pybuffer.h"
65
#include "pycore_call.h" // _PyObject_CallNoArgs()
76
#include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate()
87
#include "pycore_crossinterp.h" // _Py_CallInInterpreter()
9-
#include "pycore_object.h" // _Py_CheckSlotResult()
8+
#include "pycore_list.h" // _PyList_AppendTakeRef()
109
#include "pycore_long.h" // _Py_IsNegative
10+
#include "pycore_object.h" // _Py_CheckSlotResult()
11+
#include "pycore_pybuffer.h"
1112
#include "pycore_pyerrors.h" // _PyErr_Occurred()
1213
#include "pycore_pystate.h" // _PyThreadState_GET()
14+
#include "pycore_tuple.h" // _PyTuple_FromArraySteal()
1315
#include "pycore_unionobject.h" // _PyUnion_Check()
1416

1517
#include <stddef.h> // offsetof()

Objects/exceptions.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
#include "pycore_modsupport.h" // _PyArg_NoKeywords()
1414
#include "pycore_object.h"
1515
#include "pycore_pyerrors.h" // struct _PyErr_SetRaisedException
16+
#include "pycore_tuple.h" // _PyTuple_FromArray()
1617

1718
#include "osdefs.h" // SEP
18-
1919
#include "clinic/exceptions.c.h"
2020

21+
2122
/*[clinic input]
2223
class BaseException "PyBaseExceptionObject *" "&PyExc_BaseException"
2324
class BaseExceptionGroup "PyBaseExceptionGroupObject *" "&PyExc_BaseExceptionGroup"

Objects/object.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@
1111
#include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes()
1212
#include "pycore_floatobject.h" // _PyFloat_DebugMallocStats()
1313
#include "pycore_freelist.h" // _PyObject_ClearFreeLists()
14+
#include "pycore_hamt.h" // _PyHamtItems_Type
15+
#include "pycore_hashtable.h" // _Py_hashtable_new()
1416
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
1517
#include "pycore_instruction_sequence.h" // _PyInstructionSequence_Type
16-
#include "pycore_hashtable.h" // _Py_hashtable_new()
17-
#include "pycore_hamt.h" // _PyHamtItems_Type
18+
#include "pycore_list.h" // _PyList_DebugMallocStats()
19+
#include "pycore_long.h" // _PyLong_GetZero()
1820
#include "pycore_memoryobject.h" // _PyManagedBuffer_Type
1921
#include "pycore_namespace.h" // _PyNamespace_Type
2022
#include "pycore_object.h" // PyAPI_DATA() _Py_SwappedOp definition
2123
#include "pycore_object_state.h" // struct _reftracer_runtime_state
22-
#include "pycore_long.h" // _PyLong_GetZero()
2324
#include "pycore_optimizer.h" // _PyUOpExecutor_Type, ...
2425
#include "pycore_pyerrors.h" // _PyErr_Occurred()
2526
#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
2627
#include "pycore_pystate.h" // _PyThreadState_GET()
2728
#include "pycore_symtable.h" // PySTEntry_Type
29+
#include "pycore_tuple.h" // _PyTuple_DebugMallocStats()
2830
#include "pycore_typeobject.h" // _PyBufferWrapper_Type
2931
#include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
3032
#include "pycore_unionobject.h" // _PyUnion_Type

Objects/tupleobject.c

+2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
#include "pycore_freelist.h" // _Py_FREELIST_PUSH(), _Py_FREELIST_POP()
88
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
99
#include "pycore_initconfig.h" // _PyStatus_OK()
10+
#include "pycore_list.h" // _Py_memory_repeat()
1011
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
1112
#include "pycore_object.h" // _PyObject_GC_TRACK(), _Py_FatalRefcountError(), _PyDebugAllocatorStats()
13+
#include "pycore_tuple.h" // _PyTupleIterObject
1214

1315
/*[clinic input]
1416
class tuple "PyTupleObject *" "&PyTuple_Type"

Objects/unicodeobject.c

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5656
#include "pycore_pyhash.h" // _Py_HashSecret_t
5757
#include "pycore_pylifecycle.h" // _Py_SetFileSystemEncoding()
5858
#include "pycore_pystate.h" // _PyInterpreterState_GET()
59+
#include "pycore_tuple.h" // _PyTuple_FromArray()
5960
#include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI
6061
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
6162
#include "pycore_unicodeobject_generated.h" // _PyUnicode_InitStaticStrings()

Python/ceval.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "pycore_instruments.h"
1616
#include "pycore_intrinsics.h"
1717
#include "pycore_jit.h"
18+
#include "pycore_list.h" // _PyList_GetItemRef()
1819
#include "pycore_long.h" // _PyLong_GetZero()
1920
#include "pycore_moduleobject.h" // PyModuleObject
2021
#include "pycore_object.h" // _PyObject_GC_TRACK()

Python/gc.c

+2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include "pycore_object_alloc.h" // _PyObject_MallocWithType()
1313
#include "pycore_pyerrors.h"
1414
#include "pycore_pystate.h" // _PyThreadState_GET()
15+
#include "pycore_tuple.h" // _PyTuple_MaybeUntrack()
1516
#include "pycore_weakref.h" // _PyWeakref_ClearRef()
17+
1618
#include "pydtrace.h"
1719

1820
#ifndef Py_GIL_DISABLED

Python/gc_free_threading.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "pycore_object_alloc.h" // _PyObject_MallocWithType()
1111
#include "pycore_pystate.h" // _PyThreadState_GET()
1212
#include "pycore_tstate.h" // _PyThreadStateImpl
13+
#include "pycore_tuple.h" // _PyTuple_MaybeUntrack()
1314
#include "pycore_weakref.h" // _PyWeakref_ClearRef()
1415

1516
#include "pydtrace.h"

Python/instrumentation.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#include "Python.h"
2-
3-
#include "opcode_ids.h"
4-
52
#include "pycore_bitutils.h" // _Py_popcount32
63
#include "pycore_call.h"
74
#include "pycore_ceval.h" // _PY_EVAL_EVENTS_BITS
@@ -18,7 +15,11 @@
1815
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_UINTPTR_RELEASE
1916
#include "pycore_pyerrors.h"
2017
#include "pycore_pystate.h" // _PyInterpreterState_GET()
21-
#include "pycore_runtime_structs.h" // _PyCoMonitoringData
18+
#include "pycore_runtime_structs.h" // _PyCoMonitoringData
19+
#include "pycore_tuple.h" // _PyTuple_FromArraySteal()
20+
21+
#include "opcode_ids.h"
22+
2223

2324
/* Uncomment this to dump debugging output when assertions fail */
2425
// #define INSTRUMENT_DEBUG 1

Python/pystate.c

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "pycore_audit.h" // _Py_AuditHookEntry
99
#include "pycore_ceval.h"
1010
#include "pycore_code.h" // stats
11+
#include "pycore_codecs.h" // _PyCodec_Fini()
1112
#include "pycore_critical_section.h" // _PyCriticalSection_Resume()
1213
#include "pycore_dtoa.h" // _dtoa_state_INIT()
1314
#include "pycore_emscripten_trampoline.h" // _Py_EmscriptenTrampoline_Init()

0 commit comments

Comments
 (0)