Skip to content

Commit 6486103

Browse files
chouquettepicnixz
authored andcommitted
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`.
1 parent a0676db commit 6486103

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ensure that ``Python.h`` is included before ``stdbool.h`` unless ``pyconfig.h``
2+
is included before or in some platform-specific contexts.

Parser/string_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include <stdbool.h>
2-
31
#include <Python.h>
42

53
#include "tokenizer.h"
64
#include "pegen.h"
75
#include "string_parser.h"
86

7+
#include <stdbool.h>
8+
99
//// STRING HANDLING FUNCTIONS ////
1010

1111
static int

Python/flowgraph.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
#include <stdbool.h>
3-
41
#include "Python.h"
52
#include "pycore_flowgraph.h"
63
#include "pycore_compile.h"
@@ -11,6 +8,8 @@
118
#include "opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed
129
#undef NEED_OPCODE_METADATA
1310

11+
#include <stdbool.h>
12+
1413

1514
#undef SUCCESS
1615
#undef ERROR

0 commit comments

Comments
 (0)