summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-14 12:26:24 (GMT)
committerGitHub <noreply@github.com>2020-04-14 12:26:24 (GMT)
commit4a3fe0835310643193ea45529ab0fb45c5f8f2fd (patch)
tree6d112c3be1763e9185f805d19581347d1fc332ee
parent8ef875028a3644a329c87ce420a73793e315143f (diff)
downloadcpython-4a3fe0835310643193ea45529ab0fb45c5f8f2fd.zip
cpython-4a3fe0835310643193ea45529ab0fb45c5f8f2fd.tar.gz
cpython-4a3fe0835310643193ea45529ab0fb45c5f8f2fd.tar.bz2
bpo-40268: Include explicitly pycore_interp.h (GH-19505)
pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
-rw-r--r--Include/internal/pycore_ceval.h4
-rw-r--r--Include/internal/pycore_object.h4
-rw-r--r--Include/internal/pycore_pystate.h3
-rw-r--r--Modules/_threadmodule.c3
-rw-r--r--Modules/main.c1
-rw-r--r--Objects/codeobject.c3
-rw-r--r--Objects/interpreteridobject.c1
-rw-r--r--Objects/longobject.c3
-rw-r--r--Objects/moduleobject.c1
-rw-r--r--Parser/listnode.c3
-rw-r--r--Python/_warnings.c1
-rw-r--r--Python/codecs.c1
-rw-r--r--Python/dynload_shlib.c1
-rw-r--r--Python/import.c1
-rw-r--r--Python/initconfig.c1
-rw-r--r--Python/preconfig.c7
-rw-r--r--Python/sysmodule.c4
-rw-r--r--Python/thread_nt.h1
-rw-r--r--Python/thread_pthread.h1
19 files changed, 31 insertions, 13 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 811aada..298018a 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -13,7 +13,7 @@ struct pyruntimestate;
struct _ceval_runtime_state;
struct _frame;
-#include "pycore_pystate.h" /* PyInterpreterState.eval_frame */
+#include "pycore_interp.h" /* PyInterpreterState.eval_frame */
extern void _Py_FinishPendingCalls(PyThreadState *tstate);
extern void _PyEval_InitRuntimeState(struct _ceval_runtime_state *);
@@ -50,7 +50,7 @@ extern PyObject *_PyEval_EvalCode(
PyObject *kwdefs, PyObject *closure,
PyObject *name, PyObject *qualname);
-extern int _PyEval_ThreadsInitialized(_PyRuntimeState *runtime);
+extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime);
extern PyStatus _PyEval_InitGIL(PyThreadState *tstate);
extern void _PyEval_FiniGIL(PyThreadState *tstate);
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 5c3d3ca..7c0f24a 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -8,7 +8,9 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
-#include "pycore_pystate.h" /* PyInterpreterState.gc */
+#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
+#include "pycore_interp.h" // PyInterpreterState.gc
+#include "pycore_pystate.h" // _PyThreadState_GET()
PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);
PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 748aa63..2e78378 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -8,8 +8,7 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
-#include "pycore_interp.h" /* PyInterpreterState */
-#include "pycore_runtime.h" /* PyRuntimestate */
+#include "pycore_runtime.h" /* PyRuntimeState */
/* Check if the current thread is the main thread.
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index e2bb14e..9853699 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -4,9 +4,10 @@
#include "Python.h"
#include "pycore_pylifecycle.h"
+#include "pycore_interp.h" // _PyInterpreterState.num_threads
#include "pycore_pystate.h"
-#include "structmember.h" /* offsetof */
#include "pythread.h"
+#include <stddef.h> // offsetof()
static PyObject *ThreadError;
static PyObject *str_dict;
diff --git a/Modules/main.c b/Modules/main.c
index 00a0fc3..a9de70b 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -2,6 +2,7 @@
#include "Python.h"
#include "pycore_initconfig.h"
+#include "pycore_interp.h" // _PyInterpreterState.sysdict
#include "pycore_pathconfig.h"
#include "pycore_pylifecycle.h"
#include "pycore_pymem.h"
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 1820d8c..7cb72ce 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -5,7 +5,8 @@
#include "opcode.h"
#include "structmember.h"
#include "pycore_code.h"
-#include "pycore_pystate.h"
+#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
+#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE()
#include "pycore_tupleobject.h"
#include "clinic/codeobject.c.h"
diff --git a/Objects/interpreteridobject.c b/Objects/interpreteridobject.c
index 3f31687..84fd858 100644
--- a/Objects/interpreteridobject.c
+++ b/Objects/interpreteridobject.c
@@ -2,6 +2,7 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
+#include "pycore_interp.h" // _PyInterpreterState_LookUpID()
#include "pycore_pystate.h"
#include "interpreteridobject.h"
diff --git a/Objects/longobject.c b/Objects/longobject.c
index a66e1c4..a0bb6bc 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -3,7 +3,8 @@
/* XXX The functional organization of this file is terrible */
#include "Python.h"
-#include "pycore_pystate.h" /* _Py_IsMainInterpreter() */
+#include "pycore_interp.h" // _PY_NSMALLPOSINTS
+#include "pycore_pystate.h" // _Py_IsMainInterpreter()
#include "longintrepr.h"
#include <float.h>
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 30adc92..acb920a 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -2,6 +2,7 @@
/* Module object implementation */
#include "Python.h"
+#include "pycore_interp.h" // PyInterpreterState.importlib
#include "pycore_pystate.h"
#include "structmember.h"
diff --git a/Parser/listnode.c b/Parser/listnode.c
index d431ae5..f53b265 100644
--- a/Parser/listnode.c
+++ b/Parser/listnode.c
@@ -2,7 +2,8 @@
/* List a node on a file */
#include "Python.h"
-#include "pycore_pystate.h"
+#include "pycore_interp.h" // PyInterpreterState.parser
+#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE
#include "token.h"
#include "node.h"
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e4dfb73..d005f12 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -1,5 +1,6 @@
#include "Python.h"
#include "pycore_initconfig.h"
+#include "pycore_interp.h" // PyInterpreterState.warnings
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "frameobject.h"
diff --git a/Python/codecs.c b/Python/codecs.c
index 7b35ded..6691985 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -9,6 +9,7 @@ Copyright (c) Corporation for National Research Initiatives.
------------------------------------------------------------------------ */
#include "Python.h"
+#include "pycore_interp.h" // PyInterpreterState.codec_search_path
#include "pycore_pystate.h"
#include "ucnhash.h"
#include <ctype.h>
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 3603871..223e0d0 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -2,6 +2,7 @@
/* Support for dynamic loading of extension modules */
#include "Python.h"
+#include "pycore_interp.h" // _PyInterpreterState.dlopenflags
#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE()
#include "importdl.h"
diff --git a/Python/import.c b/Python/import.c
index d79fa18..3bf8fe0 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -9,6 +9,7 @@
#include "pycore_pyhash.h"
#include "pycore_pylifecycle.h"
#include "pycore_pymem.h"
+#include "pycore_interp.h" // _PyInterpreterState_ClearModules()
#include "pycore_pystate.h"
#include "pycore_sysmodule.h"
#include "errcode.h"
diff --git a/Python/initconfig.c b/Python/initconfig.c
index e63d6f6..43e0ccb 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -3,6 +3,7 @@
#include "pycore_fileutils.h"
#include "pycore_getopt.h"
#include "pycore_initconfig.h"
+#include "pycore_interp.h" // _PyInterpreterState.runtime
#include "pycore_pathconfig.h"
#include "pycore_pyerrors.h"
#include "pycore_pylifecycle.h"
diff --git a/Python/preconfig.c b/Python/preconfig.c
index 89a6227..db32875 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -1,8 +1,9 @@
#include "Python.h"
-#include "pycore_initconfig.h"
#include "pycore_getopt.h"
-#include "pycore_pystate.h" /* _PyRuntime_Initialize() */
-#include <locale.h> /* setlocale() */
+#include "pycore_initconfig.h"
+#include "pycore_pymem.h" // _PyMem_GetAllocatorName()
+#include "pycore_pystate.h" // _PyRuntime_Initialize()
+#include <locale.h> // setlocale()
#define DECODE_LOCALE_ERR(NAME, LEN) \
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index fd0a9c0..814e4ab 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -17,7 +17,9 @@ Data members:
#include "Python.h"
#include "code.h"
#include "frameobject.h"
-#include "pycore_ceval.h"
+#include "pycore_ceval.h" // _Py_RecursionLimitLowerWaterMark()
+#include "pycore_pystate.h" // _PyThreadState_GET()
+#include "pycore_tupleobject.h"
#include "pycore_initconfig.h"
#include "pycore_pathconfig.h"
#include "pycore_pyerrors.h"
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 23d585c..e4bd0f7 100644
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -1,3 +1,4 @@
+#include "pycore_interp.h" // _PyInterpreterState.pythread_stacksize
/* This code implemented by Dag.Gruneau@elsa.preseco.comm.se */
/* Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru */
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index e3497e7..440d845 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -1,3 +1,4 @@
+#include "pycore_interp.h" // _PyInterpreterState.pythread_stacksize
/* Posix threads interface */