summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>2025-03-02 09:56:49 (GMT)
committerGitHub <noreply@github.com>2025-03-02 09:56:49 (GMT)
commit214562ed4ddc248b007f718ed92ebcc0c3669611 (patch)
tree23abec36fbc197868e07cb1173ff6d69969a4e37 /Python
parent051f0e5683fec3840fa7fc99723741dd2d701eae (diff)
downloadcpython-214562ed4ddc248b007f718ed92ebcc0c3669611.zip
cpython-214562ed4ddc248b007f718ed92ebcc0c3669611.tar.gz
cpython-214562ed4ddc248b007f718ed92ebcc0c3669611.tar.bz2
gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)
Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not included first and when we are in a platform-agnostic context. This is to avoid having features defined by `stdbool.h` before those decided by `Python.h`.
Diffstat (limited to 'Python')
-rw-r--r--Python/codegen.c4
-rw-r--r--Python/flowgraph.c5
-rw-r--r--Python/index_pool.c4
-rw-r--r--Python/instruction_sequence.c4
4 files changed, 8 insertions, 9 deletions
diff --git a/Python/codegen.c b/Python/codegen.c
index ecad8c2..8f1a298 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -12,8 +12,6 @@
* objects.
*/
-#include <stdbool.h>
-
#include "Python.h"
#include "opcode.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
@@ -32,6 +30,8 @@
#include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed
#undef NEED_OPCODE_METADATA
+#include <stdbool.h>
+
#define COMP_GENEXP 0
#define COMP_LISTCOMP 1
#define COMP_SETCOMP 2
diff --git a/Python/flowgraph.c b/Python/flowgraph.c
index c5bdf10..fb3c73a 100644
--- a/Python/flowgraph.c
+++ b/Python/flowgraph.c
@@ -1,6 +1,3 @@
-
-#include <stdbool.h>
-
#include "Python.h"
#include "opcode.h"
#include "pycore_flowgraph.h"
@@ -12,6 +9,8 @@
#include "pycore_opcode_utils.h"
#include "pycore_opcode_metadata.h" // OPCODE_HAS_ARG, etc
+#include <stdbool.h>
+
#undef SUCCESS
#undef ERROR
diff --git a/Python/index_pool.c b/Python/index_pool.c
index 526eccf..007c81a 100644
--- a/Python/index_pool.c
+++ b/Python/index_pool.c
@@ -1,10 +1,10 @@
-#include <stdbool.h>
-
#include "Python.h"
#include "pycore_index_pool.h"
#include "pycore_lock.h"
+#include <stdbool.h>
+
#ifdef Py_GIL_DISABLED
static inline void
diff --git a/Python/instruction_sequence.c b/Python/instruction_sequence.c
index e2607e9..ed40c06 100644
--- a/Python/instruction_sequence.c
+++ b/Python/instruction_sequence.c
@@ -5,8 +5,6 @@
*/
-#include <stdbool.h>
-
#include "Python.h"
#include "pycore_compile.h" // _PyCompile_EnsureArrayLargeEnough
@@ -22,6 +20,8 @@ typedef _Py_SourceLocation location;
#include "clinic/instruction_sequence.c.h"
+#include <stdbool.h>
+
#undef SUCCESS
#undef ERROR
#define SUCCESS 0