Skip to content

Commit 830f04b

Browse files
authored
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.
1 parent fecf8bc commit 830f04b

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

@@ -20,6 +18,8 @@
2018
#include "pycore_uniqueid.h" // _PyObject_AssignUniqueId()
2119
#include "clinic/codeobject.c.h"
2220

21+
#include <stdbool.h>
22+
2323
#define INITIAL_SPECIALIZED_CODE_SIZE 16
2424

2525
static const char *

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
@@ -14,8 +14,6 @@
1414
*
1515
*/
1616

17-
#include <stdbool.h>
18-
1917
#include "Python.h"
2018
#include "pycore_ast.h" // PyAST_Check, _PyAST_GetDocString()
2119
#include "pycore_compile.h"
@@ -25,6 +23,8 @@
2523

2624
#include "cpython/code.h"
2725

26+
#include <stdbool.h>
27+
2828
#undef SUCCESS
2929
#undef ERROR
3030
#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()
@@ -29,6 +27,8 @@
2927
#include "errcode.h" // E_EOF
3028
#include "marshal.h" // PyMarshal_ReadLongFromFile()
3129

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

0 commit comments

Comments
 (0)