Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ce5f15

Browse filesBrowse files
picnixzchouquette
andauthored
[3.12] gh-130740: Move some stdbool.h includes after Python.h (#130738) (#130757)
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` (this caused some build failures when compiling CPython with `zig cc`). (cherry-picked from commit 214562e) --------- Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
1 parent 519dec9 commit 7ce5f15
Copy full SHA for 7ce5f15

9 files changed

+18-13Lines changed: 18 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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.
Collapse file

‎Objects/codeobject.c‎

Copy file name to clipboardExpand all lines: Objects/codeobject.c
+2-2Lines 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
#include "structmember.h" // PyMemberDef
@@ -11,6 +9,8 @@
119
#include "pycore_tuple.h" // _PyTuple_ITEMS()
1210
#include "clinic/codeobject.c.h"
1311

12+
#include <stdbool.h>
13+
1414
static PyObject* code_repr(PyCodeObject *co);
1515

1616
static const char *
Collapse file

‎Parser/string_parser.c‎

Copy file name to clipboardExpand all lines: Parser/string_parser.c
+2-2Lines 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
Collapse file

‎Python/assemble.c‎

Copy file name to clipboardExpand all lines: Python/assemble.c
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#include <stdbool.h>
2-
31
#include "Python.h"
42
#include "pycore_code.h" // write_location_entry_start()
53
#include "pycore_compile.h"
64
#include "pycore_opcode.h" // _PyOpcode_Caches[] and opcode category macros
75
#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
86

7+
#include <stdbool.h>
98

109
#define DEFAULT_CODE_SIZE 128
1110
#define DEFAULT_LNOTAB_SIZE 16
Collapse file

‎Python/compile.c‎

Copy file name to clipboardExpand all lines: Python/compile.c
+2-2Lines 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 "pycore_ast.h" // _PyAST_GetDocString()
2826
#define NEED_OPCODE_TABLES
@@ -38,6 +36,8 @@
3836

3937
#include "opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed
4038

39+
#include <stdbool.h>
40+
4141
#define DEFAULT_CODE_SIZE 128
4242
#define DEFAULT_LNOTAB_SIZE 16
4343
#define DEFAULT_CNOTAB_SIZE 32
Collapse file

‎Python/flowgraph.c‎

Copy file name to clipboardExpand all lines: Python/flowgraph.c
+2-3Lines 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
Collapse file

‎Python/opcode_metadata.h‎

Copy file name to clipboardExpand all lines: Python/opcode_metadata.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Python/bytecodes.c
44
// Do not edit!
55

6+
#include <stdbool.h>
7+
68
#ifndef NEED_OPCODE_METADATA
79
extern int _PyOpcode_num_popped(int opcode, int oparg, bool jump);
810
#else
Collapse file

‎Python/pythonrun.c‎

Copy file name to clipboardExpand all lines: Python/pythonrun.c
+2-2Lines 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
@@ -27,6 +25,8 @@
2725
#include "errcode.h" // E_EOF
2826
#include "marshal.h" // PyMarshal_ReadLongFromFile()
2927

28+
#include <stdbool.h>
29+
3030
#ifdef MS_WINDOWS
3131
# include "malloc.h" // alloca()
3232
#endif
Collapse file

‎Tools/cases_generator/generate_cases.py‎

Copy file name to clipboardExpand all lines: Tools/cases_generator/generate_cases.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,9 @@ def write_metadata(self) -> None:
986986
self.out.write_raw(self.from_source_files())
987987
self.out.write_raw(f"// Do not edit!\n")
988988

989+
self.out.write_raw("\n")
990+
self.out.write_raw("#include <stdbool.h>")
991+
self.out.write_raw("\n")
989992

990993
self.write_stack_effect_functions()
991994

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.