From 716969939d7989c8ca7cf6086aa9ef978884c23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Mon, 17 Feb 2025 08:00:40 +0100 Subject: [PATCH] remove inclusions prior to Python.h stdbool.h will cause to be included before Python.h can define some macros to enable some additional features, causing multiple types not to be defined down the line --- Objects/codeobject.c | 4 ++-- Python/assemble.c | 3 +-- Python/compile.c | 4 ++-- Python/pythonrun.c | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Objects/codeobject.c b/Objects/codeobject.c index a7b46aa2dfbbc0..833c4d10ba8318 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1,5 +1,3 @@ -#include - #include "Python.h" #include "opcode.h" @@ -20,6 +18,8 @@ #include "pycore_uniqueid.h" // _PyObject_AssignUniqueId() #include "clinic/codeobject.c.h" +#include + #define INITIAL_SPECIALIZED_CODE_SIZE 16 static const char * diff --git a/Python/assemble.c b/Python/assemble.c index f7b88b519f5f71..6dcac332f076d8 100644 --- a/Python/assemble.c +++ b/Python/assemble.c @@ -1,5 +1,3 @@ -#include - #include "Python.h" #include "pycore_code.h" // write_location_entry_start() #include "pycore_compile.h" @@ -8,6 +6,7 @@ #include "pycore_opcode_metadata.h" // is_pseudo_target, _PyOpcode_Caches #include "pycore_symtable.h" // _Py_SourceLocation +#include #define DEFAULT_CODE_SIZE 128 #define DEFAULT_LNOTAB_SIZE 16 diff --git a/Python/compile.c b/Python/compile.c index b58c12d4b881ac..cd68b897cf6188 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -14,8 +14,6 @@ * */ -#include - #include "Python.h" #include "pycore_ast.h" // PyAST_Check, _PyAST_GetDocString() #include "pycore_compile.h" @@ -25,6 +23,8 @@ #include "cpython/code.h" +#include + #undef SUCCESS #undef ERROR #define SUCCESS 0 diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 9b882d982a9e50..75d91b2040cdd5 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -8,8 +8,6 @@ /* TODO: Cull includes following phase split */ -#include - #include "Python.h" #include "pycore_ast.h" // PyAST_mod2obj() @@ -29,6 +27,8 @@ #include "errcode.h" // E_EOF #include "marshal.h" // PyMarshal_ReadLongFromFile() +#include + #ifdef MS_WINDOWS # include "malloc.h" // alloca() #endif