]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Postpone <stdbool.h> inclusion after Python.h (#130641) (#130675)
authorVictor Stinner <vstinner@python.org>
Fri, 28 Feb 2025 09:40:06 +0000 (10:40 +0100)
committerGitHub <noreply@github.com>
Fri, 28 Feb 2025 09:40:06 +0000 (09:40 +0000)
Postpone <stdbool.h> inclusion after Python.h (#130641)

Remove inclusions prior to Python.h.

<stdbool.h> will cause <features.h> 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.

(cherry picked from commit 830f04b5056db92ba96387db0a778dcd19a39522)

Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Objects/codeobject.c
Python/assemble.c
Python/compile.c
Python/pythonrun.c

index 6c4eef8e0116a3c00e14f1e604dbd172b11d7b31..5f491fe554273d81f17e1b326c170bfd9fd1feb1 100644 (file)
@@ -1,5 +1,3 @@
-#include <stdbool.h>
-
 #include "Python.h"
 #include "opcode.h"
 
@@ -16,6 +14,8 @@
 #include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include "clinic/codeobject.c.h"
 
+#include <stdbool.h>
+
 static const char *
 code_event_name(PyCodeEvent event) {
     switch (event) {
index 945c8ac39f53acd65c3a73e9adb511ece2103120..671bc7caf17ba3629ded67dc62635d5b04f18969 100644 (file)
@@ -1,5 +1,3 @@
-#include <stdbool.h>
-
 #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 <stdbool.h>
 
 #define DEFAULT_CODE_SIZE 128
 #define DEFAULT_LNOTAB_SIZE 16
index c3cffd3920a0282844da11edfe0fc07a09233211..ba780927eff9d60b6e2c3af8ffeb00e7efddac68 100644 (file)
@@ -21,8 +21,6 @@
  * objects.
  */
 
-#include <stdbool.h>
-
 #include "Python.h"
 #include "opcode.h"
 #include "pycore_ast.h"           // _PyAST_GetDocString()
@@ -57,6 +55,8 @@
  */
 #define STACK_USE_GUIDELINE 30
 
+#include <stdbool.h>
+
 #undef SUCCESS
 #undef ERROR
 #define SUCCESS 0
index 2092f3adf0c9ec7af535aeda60497a668666b9be..eea638354fe8f361456e962d90a33db74b9b5a46 100644 (file)
@@ -8,8 +8,6 @@
 
 /* TODO: Cull includes following phase split */
 
-#include <stdbool.h>
-
 #include "Python.h"
 
 #include "pycore_ast.h"           // PyAST_mod2obj()
@@ -28,6 +26,8 @@
 #include "errcode.h"              // E_EOF
 #include "marshal.h"              // PyMarshal_ReadLongFromFile()
 
+#include <stdbool.h>
+
 #ifdef MS_WINDOWS
 #  include "malloc.h"             // alloca()
 #endif