Skip to content

Commit 10ed9b7

Browse files
committed
gh-131238: Remove includes from pycore_interp.h
Remove also now unused includes in C files.
1 parent 39b37b0 commit 10ed9b7

26 files changed

+77
-90
lines changed

Include/internal/pycore_code.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#include "pycore_structs.h" // _Py_CODEUNIT
12-
#include "pycore_stackref.h" // _PyStackRef
1311
#include "pycore_backoff.h" // _Py_BackoffCounter
12+
#include "pycore_structs.h" // _Py_CODEUNIT
1413
#include "pycore_tstate.h" // _PyThreadStateImpl
1514

1615

Include/internal/pycore_freelist.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ extern "C" {
99
#endif
1010

1111
#include "pycore_freelist_state.h" // struct _Py_freelists
12-
#include "pycore_object.h" // _PyObject_IS_GC
12+
#include "pycore_interp_structs.h" // PyInterpreterState
13+
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_PTR_RELAXED()
1314
#include "pycore_pystate.h" // _PyThreadState_GET
1415
#include "pycore_stats.h" // OBJECT_STAT_INC
1516

Include/internal/pycore_interp.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#include "pycore_genobject.h" // _PyGen_FetchStopIterationValue
11+
#include "pycore_interp_structs.h" // PyInterpreterState
1212

1313

1414
/* interpreter state */
@@ -27,7 +27,6 @@ extern "C" {
2727

2828
extern void _PyInterpreterState_Clear(PyThreadState *tstate);
2929

30-
3130
static inline PyThreadState*
3231
_PyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
3332
return (PyThreadState*)_Py_atomic_load_ptr_relaxed(&interp->_finalizing);
@@ -53,7 +52,6 @@ _PyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tst
5352
}
5453

5554

56-
5755
// Exports for the _testinternalcapi module.
5856
PyAPI_FUNC(int64_t) _PyInterpreterState_ObjectToID(PyObject *);
5957
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_LookUpID(int64_t);

Modules/_interpretersmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
#endif
77

88
#include "Python.h"
9-
#include "pycore_abstract.h" // _PyIndex_Check()
9+
#include "pycore_code.h" // _PyCode_HAS_EXECUTORS()
1010
#include "pycore_crossinterp.h" // _PyXIData_t
1111
#include "pycore_interp.h" // _PyInterpreterState_IDIncref()
12-
#include "pycore_initconfig.h" // _PyErr_SetFromPyStatus()
1312
#include "pycore_modsupport.h" // _PyArg_BadArgument()
1413
#include "pycore_namespace.h" // _PyNamespace_New()
1514
#include "pycore_pybuffer.h" // _PyBuffer_ReleaseInInterpreterAndRawFree()
16-
#include "pycore_pyerrors.h" // _Py_excinfo
1715
#include "pycore_pylifecycle.h" // _PyInterpreterConfig_AsDict()
18-
#include "pycore_pystate.h" // _PyInterpreterState_SetRunningMain()
16+
#include "pycore_pystate.h" // _PyInterpreterState_IsRunningMain()
1917

2018
#include "marshal.h" // PyMarshal_ReadObjectFromString()
2119

Modules/_lsprof.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "pycore_ceval.h" // _PyEval_SetProfile()
88
#include "pycore_pystate.h" // _PyThreadState_GET()
99
#include "pycore_time.h" // _PyTime_FromLong()
10+
#include "pycore_typeobject.h" // _PyType_GetModuleState()
1011
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
1112

1213
#include "rotatingtree.h"

Modules/_testcapi/watchers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "clinic/watchers.c.h"
77

88
#define Py_BUILD_CORE
9-
#include "pycore_function.h" // FUNC_MAX_WATCHERS
10-
#include "pycore_code.h" // CODE_MAX_WATCHERS
11-
#include "pycore_context.h" // CONTEXT_MAX_WATCHERS
9+
#include "pycore_function.h" // FUNC_MAX_WATCHERS
10+
#include "pycore_interp_structs.h" // CODE_MAX_WATCHERS
11+
#include "pycore_context.h" // CONTEXT_MAX_WATCHERS
1212

1313
/*[clinic input]
1414
module _testcapi

Modules/_testinternalcapi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "pycore_code.h" // _PyCode_GetTLBCFast()
1818
#include "pycore_compile.h" // _PyCompile_CodeGen()
1919
#include "pycore_context.h" // _PyContext_NewHamtForTests()
20-
#include "pycore_dict.h" // _PyManagedDictPointer_GetValues()
20+
#include "pycore_dict.h" // PyDictValues
2121
#include "pycore_fileutils.h" // _Py_normpath()
2222
#include "pycore_flowgraph.h" // _PyCompile_OptimizeCfg()
2323
#include "pycore_frame.h" // _PyInterpreterFrame
@@ -26,11 +26,11 @@
2626
#include "pycore_import.h" // _PyImport_ClearExtension()
2727
#include "pycore_initconfig.h" // _Py_GetConfigsAsDict()
2828
#include "pycore_instruction_sequence.h" // _PyInstructionSequence_New()
29+
#include "pycore_interpframe.h" // _PyFrame_GetFunction()
2930
#include "pycore_object.h" // _PyObject_IsFreed()
30-
#include "pycore_optimizer.h" // JitOptSymbol, etc.
3131
#include "pycore_pathconfig.h" // _PyPathConfig_ClearGlobal()
3232
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
33-
#include "pycore_pylifecycle.h" // _PyInterpreterConfig_AsDict()
33+
#include "pycore_pylifecycle.h" // _PyInterpreterConfig_InitFromDict()
3434
#include "pycore_pystate.h" // _PyThreadState_GET()
3535
#include "pycore_unicodeobject.h" // _PyUnicode_TransformDecimalAndSpaceToASCII()
3636

Modules/signalmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "pycore_ceval.h" // _PyEval_SignalReceived()
99
#include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS
1010
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
11-
#include "pycore_frame.h" // _PyInterpreterFrame
11+
#include "pycore_interpframe.h" // _PyThreadState_GetFrame()
1212
#include "pycore_moduleobject.h" // _PyModule_GetState()
1313
#include "pycore_pyerrors.h" // _PyErr_SetString()
1414
#include "pycore_pystate.h" // _PyThreadState_GET()

Objects/abstract.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
#include "pycore_call.h" // _PyObject_CallNoArgs()
66
#include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate()
77
#include "pycore_crossinterp.h" // _Py_CallInInterpreter()
8+
#include "pycore_genobject.h" // _PyGen_FetchStopIterationValue()
89
#include "pycore_list.h" // _PyList_AppendTakeRef()
9-
#include "pycore_long.h" // _Py_IsNegative
10+
#include "pycore_long.h" // _PyLong_IsNegative()
1011
#include "pycore_object.h" // _Py_CheckSlotResult()
11-
#include "pycore_pybuffer.h"
12+
#include "pycore_pybuffer.h" // _PyBuffer_ReleaseInInterpreterAndRawFree()
1213
#include "pycore_pyerrors.h" // _PyErr_Occurred()
1314
#include "pycore_pystate.h" // _PyThreadState_GET()
1415
#include "pycore_tuple.h" // _PyTuple_FromArraySteal()

Objects/codeobject.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
#include "opcode.h"
33

44
#include "pycore_code.h" // _PyCodeConstructor
5-
#include "pycore_frame.h" // FRAME_SPECIALS_SIZE
65
#include "pycore_hashtable.h" // _Py_hashtable_t
7-
#include "pycore_index_pool.h" // _PyIndexPool
6+
#include "pycore_index_pool.h" // _PyIndexPool_Fini()
87
#include "pycore_initconfig.h" // _PyStatus_OK()
98
#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
10-
#include "pycore_object.h" // _PyObject_SetDeferredRefcount
11-
#include "pycore_object_stack.h"
12-
#include "pycore_opcode_metadata.h" // _PyOpcode_Deopt, _PyOpcode_Caches
9+
#include "pycore_interpframe.h" // FRAME_SPECIALS_SIZE
10+
#include "pycore_opcode_metadata.h" // _PyOpcode_Caches
1311
#include "pycore_opcode_utils.h" // RESUME_AT_FUNC_START
14-
#include "pycore_pymem.h" // _PyMem_FreeDelayed
12+
#include "pycore_pymem.h" // _PyMem_FreeDelayed()
1513
#include "pycore_pystate.h" // _PyInterpreterState_GET()
1614
#include "pycore_setobject.h" // _PySet_NextEntry()
1715
#include "pycore_tuple.h" // _PyTuple_ITEMS()

0 commit comments

Comments
 (0)