Skip to content

Commit

Permalink
bpo-40268: Remove a few pycore_pystate.h includes (pythonGH-19510)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored Apr 14, 2020
1 parent e194530 commit e5014be
Show file tree
Hide file tree
Showing 56 changed files with 78 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Python.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_tupleobject.h"
#include "structmember.h"

Expand Down
1 change: 0 additions & 1 deletion Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "structmember.h"
#include "pythread.h"
#include "_iomodule.h"
Expand Down
3 changes: 2 additions & 1 deletion Modules/_io/textio.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_interp.h" // PyInterpreterState.fs_codec
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "structmember.h"
#include "_iomodule.h"

Expand Down
2 changes: 1 addition & 1 deletion Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Python.h"
#include "pycore_pylifecycle.h"
#include "pycore_interp.h" // _PyInterpreterState.num_threads
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_Init()
#include "pythread.h"
#include <stddef.h> // offsetof()

Expand Down
7 changes: 4 additions & 3 deletions Modules/gcmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
#include "Python.h"
#include "pycore_context.h"
#include "pycore_initconfig.h"
#include "pycore_interp.h" // PyInterpreterState.gc
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "frameobject.h" /* for PyFrame_ClearFreeList */
#include "frameobject.h" // PyFrame_ClearFreeList
#include "pydtrace.h"
#include "pytime.h" /* for _PyTime_GetMonotonicClock() */
#include "pytime.h" // _PyTime_GetMonotonicClock()

typedef struct _gc_runtime_state GCState;

Expand Down
5 changes: 2 additions & 3 deletions Modules/getpath.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* Return the initial module search path. */

#include "Python.h"
#include "pycore_initconfig.h"
#include "osdefs.h"
#include "pycore_fileutils.h"
#include "pycore_initconfig.h"
#include "pycore_pathconfig.h"
#include "pycore_pystate.h"
#include "osdefs.h"

#include <sys/types.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "pycore_pathconfig.h"
#include "pycore_pylifecycle.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()

/* Includes for exit_sigint() */
#include <stdio.h> /* perror() */
Expand Down
2 changes: 1 addition & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "pycore_ceval.h" /* _PyEval_ReInitThreads() */
#include "pycore_import.h" /* _PyImport_ReInitLock() */
#include "pycore_pystate.h" /* _PyRuntime */
#include "pycore_pystate.h" /* _PyInterpreterState_GET() */
#include "pythread.h"
#include "structmember.h"
#ifndef MS_WINDOWS
Expand Down
2 changes: 1 addition & 1 deletion Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "pycore_call.h"
#include "pycore_ceval.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()

#ifndef MS_WINDOWS
#include "posixmodule.h"
Expand Down
2 changes: 1 addition & 1 deletion Objects/abstract.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include <ctype.h>
#include "structmember.h" /* we need the offsetof() macro from there */
#include "longintrepr.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/call.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "Python.h"
#include "pycore_call.h"
#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_ceval.h" // _PyEval_EvalFrame()
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_tupleobject.h"
#include "frameobject.h"

Expand Down
1 change: 0 additions & 1 deletion Objects/cellobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"

PyObject *
PyCell_New(PyObject *obj)
Expand Down
2 changes: 1 addition & 1 deletion Objects/classobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "structmember.h"

#define TP_DESCR_GET(t) ((t)->tp_descr_get)
Expand Down
4 changes: 2 additions & 2 deletions Objects/descrobject.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Descriptors -- a new, flexible way to describe attributes */

#include "Python.h"
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_tupleobject.h"
#include "structmember.h" /* Why is this not included in Python.h? */

Expand Down
5 changes: 3 additions & 2 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ converting the dict to the combined table.
#define PyDict_MINSIZE 8

#include "Python.h"
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "dict-common.h"
#include "stringlib/eq.h" /* to get unicode_eq() */
#include "stringlib/eq.h" // unicode_eq()

/*[clinic input]
class dict "PyDictObject *" "&PyDict_Type"
Expand Down
1 change: 0 additions & 1 deletion Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "structmember.h"
#include "osdefs.h"

Expand Down
2 changes: 1 addition & 1 deletion Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_pystate.h"
#include "pycore_runtime.h" // _PyRuntime

#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
/* clang MemorySanitizer doesn't yet understand getc_unlocked. */
Expand Down
2 changes: 1 addition & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()

#include "code.h"
#include "frameobject.h"
Expand Down
1 change: 0 additions & 1 deletion Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pycore_tupleobject.h"
#include "code.h"
#include "structmember.h"
Expand Down
4 changes: 2 additions & 2 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Generator object implementation */

#include "Python.h"
#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_ceval.h" // _PyEval_EvalFrame()
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "frameobject.h"
#include "structmember.h"
#include "opcode.h"
Expand Down
1 change: 0 additions & 1 deletion Objects/interpreteridobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_interp.h" // _PyInterpreterState_LookUpID()
#include "pycore_pystate.h"
#include "interpreteridobject.h"


Expand Down
1 change: 0 additions & 1 deletion Objects/iterobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"

typedef struct {
PyObject_HEAD
Expand Down
1 change: 0 additions & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_tupleobject.h"
#include "pycore_accu.h"

Expand Down
1 change: 0 additions & 1 deletion Objects/memoryobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pystrhex.h"
#include <stddef.h>

Expand Down
4 changes: 2 additions & 2 deletions Objects/methodobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/* Method object implementation */

#include "Python.h"
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "structmember.h"

/* undefine macro trampoline to PyCFunction_NewEx */
Expand Down
2 changes: 1 addition & 1 deletion Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "Python.h"
#include "pycore_interp.h" // PyInterpreterState.importlib
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "structmember.h"

static Py_ssize_t max_module_number;
Expand Down
4 changes: 2 additions & 2 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/* Generic object operations; and implementation of None */

#include "Python.h"
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_context.h"
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "frameobject.h"
#include "interpreteridobject.h"

Expand Down
3 changes: 1 addition & 2 deletions Objects/odictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ Potential Optimizations

#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "structmember.h"
#include "dict-common.h"
#include <stddef.h>
Expand Down Expand Up @@ -890,7 +889,7 @@ odict_inplace_or(PyObject *self, PyObject *other)
if (mutablemapping_update_arg(self, other) < 0) {
return NULL;
}
Py_INCREF(self);
Py_INCREF(self);
return self;
}

Expand Down
3 changes: 1 addition & 2 deletions Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
*/

#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "structmember.h"

/* Object used as dummy key to fill deleted entries */
Expand Down
1 change: 0 additions & 1 deletion Objects/sliceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ this type and there is exactly one in existence.
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
#include "structmember.h"

static PyObject *
Expand Down
4 changes: 2 additions & 2 deletions Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_accu.h"
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
#include "pycore_object.h"

/*[clinic input]
class tuple "PyTupleObject *" "&PyTuple_Type"
Expand Down
2 changes: 1 addition & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "frameobject.h"
#include "structmember.h"

Expand Down
5 changes: 3 additions & 2 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_bytes_methods.h"
#include "pycore_fileutils.h"
#include "pycore_initconfig.h"
#include "pycore_interp.h" // PyInterpreterState.fs_codec
#include "pycore_object.h"
#include "pycore_pathconfig.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "ucnhash.h"
#include "stringlib/eq.h"

Expand Down
1 change: 0 additions & 1 deletion PC/getpathp.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
#include "Python.h"
#include "pycore_initconfig.h" /* PyStatus */
#include "pycore_pathconfig.h" /* _PyPathConfig */
#include "pycore_pystate.h"
#include "osdefs.h"
#include <wchar.h>

Expand Down
4 changes: 2 additions & 2 deletions Parser/listnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* List a node on a file */

#include "Python.h"
#include "pycore_interp.h" // PyInterpreterState.parser
#include "pycore_pystate.h" // _PyInterpreterState_GET
#include "pycore_interp.h" // PyInterpreterState.parser
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "token.h"
#include "node.h"

Expand Down
6 changes: 3 additions & 3 deletions Parser/myreadline.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/

#include "Python.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
#ifdef MS_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
# define WIN32_LEAN_AND_MEAN
# include "windows.h"
#endif /* MS_WINDOWS */


Expand Down
4 changes: 2 additions & 2 deletions Programs/_testembed.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#undef NDEBUG

#include <Python.h>
#include "pycore_initconfig.h" /* _PyConfig_InitCompatConfig() */
#include "pycore_pystate.h" /* _PyRuntime */
#include "pycore_initconfig.h" // _PyConfig_InitCompatConfig()
#include "pycore_runtime.h" // _PyRuntime
#include <Python.h>
#include "pythread.h"
#include <inttypes.h>
Expand Down
Loading

0 comments on commit e5014be

Please sign in to comment.