Skip to content

Commit 20c5f96

Browse files
authored
gh-131238: Remove more includes from pycore_interp.h (#131480)
1 parent 63b5aed commit 20c5f96

31 files changed

+92
-57
lines changed

Include/internal/pycore_ceval.h

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

11-
#include "dynamic_annotations.h" // _Py_ANNOTATE_RWLOCK_CREATE
11+
#include "dynamic_annotations.h" // _Py_ANNOTATE_RWLOCK_CREATE
1212

13+
#include "pycore_code.h" // _PyCode_GetTLBCFast()
1314
#include "pycore_interp.h" // PyInterpreterState.eval_frame
1415
#include "pycore_pystate.h" // _PyThreadState_GET()
16+
#include "pycore_stats.h" // EVAL_CALL_STAT_INC()
1517
#include "pycore_typedefs.h" // _PyInterpreterFrame
1618

1719

Include/internal/pycore_interp.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@ extern "C" {
1111
#include <stdbool.h> // bool
1212

1313
#include "pycore_runtime_structs.h"
14-
#include "pycore_code.h" // struct callable_cache
15-
#include "pycore_floatobject.h" // struct _Py_float_state
16-
#include "pycore_gc.h" // struct _gc_runtime_state
1714
#include "pycore_genobject.h" // _PyGen_FetchStopIterationValue
18-
#include "pycore_import.h" // struct _import_state
19-
#include "pycore_optimizer.h" // _PyExecutorObject
20-
#include "pycore_typeobject.h" // struct types_state
21-
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
22-
#include "pycore_warnings.h" // struct _warnings_runtime_state
2315

2416

2517
/* interpreter state */

Include/internal/pycore_runtime_init.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern "C" {
1616
#include "pycore_floatobject.h" // _py_float_format_unknown
1717
#include "pycore_function.h"
1818
#include "pycore_hamt.h" // _PyHamt_BitmapNode_Type
19+
#include "pycore_import.h" // IMPORTS_INIT
1920
#include "pycore_object.h" // _PyObject_HEAD_INIT
2021
#include "pycore_obmalloc_init.h" // _obmalloc_global_state_INIT
2122
#include "pycore_parser.h" // _parser_runtime_state_INIT

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ bytes(cdata)
108108

109109
#include "pycore_call.h" // _PyObject_CallNoArgs()
110110
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
111+
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
111112
#ifdef MS_WIN32
112113
# include "pycore_modsupport.h" // _PyArg_NoKeywords()
113114
#endif

Modules/_io/textio.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
*/
88

99
#include "Python.h"
10-
#include "pycore_call.h" // _PyObject_CallMethod()
11-
#include "pycore_codecs.h" // _PyCodecInfo_GetIncrementalDecoder()
12-
#include "pycore_fileutils.h" // _Py_GetLocaleEncoding()
13-
#include "pycore_interp.h" // PyInterpreterState.fs_codec
14-
#include "pycore_long.h" // _PyLong_GetZero()
15-
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
16-
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
17-
#include "pycore_pystate.h" // _PyInterpreterState_GET()
10+
#include "pycore_call.h" // _PyObject_CallMethod()
11+
#include "pycore_codecs.h" // _PyCodecInfo_GetIncrementalDecoder()
12+
#include "pycore_fileutils.h" // _Py_GetLocaleEncoding()
13+
#include "pycore_interp.h" // PyInterpreterState.fs_codec
14+
#include "pycore_long.h" // _PyLong_GetZero()
15+
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
16+
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
17+
#include "pycore_pystate.h" // _PyInterpreterState_GET()
18+
#include "pycore_unicodeobject.h" // _PyUnicode_AsASCIIString()
1819

1920
#include "_iomodule.h"
2021

Modules/_json.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
#endif
1010

1111
#include "Python.h"
12-
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
13-
#include "pycore_runtime.h" // _PyRuntime
14-
#include "pycore_pyerrors.h" // _PyErr_FormatNote
12+
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
13+
#include "pycore_global_strings.h" // _Py_ID()
14+
#include "pycore_pyerrors.h" // _PyErr_FormatNote
15+
#include "pycore_runtime.h" // _PyRuntime
16+
#include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency()
1517

16-
#include "pycore_global_strings.h" // _Py_ID()
17-
#include <stdbool.h> // bool
18+
#include <stdbool.h> // bool
1819

1920

2021
typedef struct _PyScannerObject {

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_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
1011

1112
#include "rotatingtree.h"
1213

Modules/_pickle.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99
#endif
1010

1111
#include "Python.h"
12-
#include "pycore_bytesobject.h" // _PyBytesWriter
13-
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
14-
#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION()
15-
#include "pycore_long.h" // _PyLong_AsByteArray()
16-
#include "pycore_moduleobject.h" // _PyModule_GetState()
17-
#include "pycore_object.h" // _PyNone_Type
18-
#include "pycore_pyerrors.h" // _PyErr_FormatNote
19-
#include "pycore_pystate.h" // _PyThreadState_GET()
20-
#include "pycore_runtime.h" // _Py_ID()
21-
#include "pycore_setobject.h" // _PySet_NextEntry()
22-
#include "pycore_sysmodule.h" // _PySys_GetSizeOf()
12+
#include "pycore_bytesobject.h" // _PyBytesWriter
13+
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
14+
#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION()
15+
#include "pycore_long.h" // _PyLong_AsByteArray()
16+
#include "pycore_moduleobject.h" // _PyModule_GetState()
17+
#include "pycore_object.h" // _PyNone_Type
18+
#include "pycore_pyerrors.h" // _PyErr_FormatNote
19+
#include "pycore_pystate.h" // _PyThreadState_GET()
20+
#include "pycore_runtime.h" // _Py_ID()
21+
#include "pycore_setobject.h" // _PySet_NextEntry()
22+
#include "pycore_sysmodule.h" // _PySys_GetSizeOf()
23+
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
2324

2425
#include <stdlib.h> // strtol()
2526

Modules/_posixsubprocess.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#endif
55

66
#include "Python.h"
7+
#include "pycore_fileutils.h" // _Py_set_inheritable_async_safe()
78
#include "pycore_interp.h" // _PyInterpreterState_GetFinalizing()
89
#include "pycore_pystate.h" // _PyInterpreterState_GET()
910
#include "pycore_signal.h" // _Py_RestoreSignals()

Modules/_testinternalcapi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "pycore_frame.h" // _PyInterpreterFrame
2424
#include "pycore_gc.h" // PyGC_Head
2525
#include "pycore_hashtable.h" // _Py_hashtable_new()
26+
#include "pycore_import.h" // _PyImport_ClearExtension()
2627
#include "pycore_initconfig.h" // _Py_GetConfigsAsDict()
2728
#include "pycore_instruction_sequence.h" // _PyInstructionSequence_New()
2829
#include "pycore_object.h" // _PyObject_IsFreed()
@@ -31,6 +32,7 @@
3132
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
3233
#include "pycore_pylifecycle.h" // _PyInterpreterConfig_AsDict()
3334
#include "pycore_pystate.h" // _PyThreadState_GET()
35+
#include "pycore_unicodeobject.h" // _PyUnicode_TransformDecimalAndSpaceToASCII()
3436

3537
#include "clinic/_testinternalcapi.c.h"
3638

0 commit comments

Comments
 (0)