X Tutup
Skip to content

Commit 4a3fe08

Browse files
authored
bpo-40268: Include explicitly pycore_interp.h (pythonGH-19505)
pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
1 parent 8ef8750 commit 4a3fe08

19 files changed

+31
-13
lines changed

Include/internal/pycore_ceval.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct pyruntimestate;
1313
struct _ceval_runtime_state;
1414
struct _frame;
1515

16-
#include "pycore_pystate.h" /* PyInterpreterState.eval_frame */
16+
#include "pycore_interp.h" /* PyInterpreterState.eval_frame */
1717

1818
extern void _Py_FinishPendingCalls(PyThreadState *tstate);
1919
extern void _PyEval_InitRuntimeState(struct _ceval_runtime_state *);
@@ -50,7 +50,7 @@ extern PyObject *_PyEval_EvalCode(
5050
PyObject *kwdefs, PyObject *closure,
5151
PyObject *name, PyObject *qualname);
5252

53-
extern int _PyEval_ThreadsInitialized(_PyRuntimeState *runtime);
53+
extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime);
5454
extern PyStatus _PyEval_InitGIL(PyThreadState *tstate);
5555
extern void _PyEval_FiniGIL(PyThreadState *tstate);
5656

Include/internal/pycore_object.h

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

11-
#include "pycore_pystate.h" /* PyInterpreterState.gc */
11+
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
12+
#include "pycore_interp.h" // PyInterpreterState.gc
13+
#include "pycore_pystate.h" // _PyThreadState_GET()
1214

1315
PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);
1416
PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);

Include/internal/pycore_pystate.h

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

11-
#include "pycore_interp.h" /* PyInterpreterState */
12-
#include "pycore_runtime.h" /* PyRuntimestate */
11+
#include "pycore_runtime.h" /* PyRuntimeState */
1312

1413

1514
/* Check if the current thread is the main thread.

Modules/_threadmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
#include "Python.h"
66
#include "pycore_pylifecycle.h"
7+
#include "pycore_interp.h" // _PyInterpreterState.num_threads
78
#include "pycore_pystate.h"
8-
#include "structmember.h" /* offsetof */
99
#include "pythread.h"
10+
#include <stddef.h> // offsetof()
1011

1112
static PyObject *ThreadError;
1213
static PyObject *str_dict;

Modules/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Python.h"
44
#include "pycore_initconfig.h"
5+
#include "pycore_interp.h" // _PyInterpreterState.sysdict
56
#include "pycore_pathconfig.h"
67
#include "pycore_pylifecycle.h"
78
#include "pycore_pymem.h"

Objects/codeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include "opcode.h"
66
#include "structmember.h"
77
#include "pycore_code.h"
8-
#include "pycore_pystate.h"
8+
#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
9+
#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE()
910
#include "pycore_tupleobject.h"
1011
#include "clinic/codeobject.c.h"
1112

Objects/interpreteridobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Python.h"
44
#include "pycore_abstract.h" // _PyIndex_Check()
5+
#include "pycore_interp.h" // _PyInterpreterState_LookUpID()
56
#include "pycore_pystate.h"
67
#include "interpreteridobject.h"
78

Objects/longobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
/* XXX The functional organization of this file is terrible */
44

55
#include "Python.h"
6-
#include "pycore_pystate.h" /* _Py_IsMainInterpreter() */
6+
#include "pycore_interp.h" // _PY_NSMALLPOSINTS
7+
#include "pycore_pystate.h" // _Py_IsMainInterpreter()
78
#include "longintrepr.h"
89

910
#include <float.h>

Objects/moduleobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Module object implementation */
33

44
#include "Python.h"
5+
#include "pycore_interp.h" // PyInterpreterState.importlib
56
#include "pycore_pystate.h"
67
#include "structmember.h"
78

Parser/listnode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/* List a node on a file */
33

44
#include "Python.h"
5-
#include "pycore_pystate.h"
5+
#include "pycore_interp.h" // PyInterpreterState.parser
6+
#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE
67
#include "token.h"
78
#include "node.h"
89

0 commit comments

Comments
 (0)
X Tutup