Skip to content

Commit 9184b1b

Browse files
vstinnerchouquette
andauthored
[3.13] Postpone <stdbool.h> inclusion after Python.h (#130641) (#130675)
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 830f04b) Co-authored-by: Hugo Beauzée-Luyssen <[email protected]>
1 parent b223dc7 commit 9184b1b

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

Objects/codeobject.c

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

@@ -16,6 +14,8 @@
1614
#include "pycore_tuple.h" // _PyTuple_ITEMS()
1715
#include "clinic/codeobject.c.h"
1816

17+
#include <stdbool.h>
18+
1919
static const char *
2020
code_event_name(PyCodeEvent event) {
2121
switch (event) {

Python/assemble.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <stdbool.h>
2-
31
#include "Python.h"
42
#include "pycore_code.h" // write_location_entry_start()
53
#include "pycore_compile.h"
@@ -8,6 +6,7 @@
86
#include "pycore_opcode_metadata.h" // is_pseudo_target, _PyOpcode_Caches
97
#include "pycore_symtable.h" // _Py_SourceLocation
108

9+
#include <stdbool.h>
1110

1211
#define DEFAULT_CODE_SIZE 128
1312
#define DEFAULT_LNOTAB_SIZE 16

Python/compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
* objects.
2222
*/
2323

24-
#include <stdbool.h>
25-
2624
#include "Python.h"
2725
#include "opcode.h"
2826
#include "pycore_ast.h" // _PyAST_GetDocString()
@@ -57,6 +55,8 @@
5755
*/
5856
#define STACK_USE_GUIDELINE 30
5957

58+
#include <stdbool.h>
59+
6060
#undef SUCCESS
6161
#undef ERROR
6262
#define SUCCESS 0

Python/pythonrun.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
/* TODO: Cull includes following phase split */
1010

11-
#include <stdbool.h>
12-
1311
#include "Python.h"
1412

1513
#include "pycore_ast.h" // PyAST_mod2obj()
@@ -28,6 +26,8 @@
2826
#include "errcode.h" // E_EOF
2927
#include "marshal.h" // PyMarshal_ReadLongFromFile()
3028

29+
#include <stdbool.h>
30+
3131
#ifdef MS_WINDOWS
3232
# include "malloc.h" // alloca()
3333
#endif

0 commit comments

Comments
 (0)