Skip to content

gh-130740: Move some stdbool.h includes after Python.h #130738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ensure that ``Python.h`` is included before ``stdbool.h`` unless ``pyconfig.h``
is included before or in some platform-specific contexts.
2 changes: 1 addition & 1 deletion Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# define Py_BUILD_CORE_MODULE 1
#endif

#include <stdbool.h>
#include "Python.h"
#include "pycore_hashtable.h"
#include "pycore_strhex.h" // _Py_strhex()
Expand All @@ -37,6 +36,7 @@
#include <openssl/objects.h>
#include <openssl/err.h>

#include <stdbool.h>

#ifndef OPENSSL_THREADS
# error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
Expand Down
4 changes: 2 additions & 2 deletions Parser/string_parser.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdbool.h>

#include <Python.h>
#include "pycore_bytesobject.h" // _PyBytes_DecodeEscape()
#include "pycore_unicodeobject.h" // _PyUnicode_DecodeUnicodeEscapeInternal()
Expand All @@ -8,6 +6,8 @@
#include "pegen.h"
#include "string_parser.h"

#include <stdbool.h>

//// STRING HANDLING FUNCTIONS ////

static int
Expand Down
4 changes: 2 additions & 2 deletions Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* objects.
*/

#include <stdbool.h>

#include "Python.h"
#include "opcode.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions Python/flowgraph.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

#include <stdbool.h>

#include "Python.h"
#include "opcode.h"
#include "pycore_flowgraph.h"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Python/index_pool.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Python/instruction_sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/


#include <stdbool.h>

#include "Python.h"

#include "pycore_compile.h" // _PyCompile_EnsureArrayLargeEnough
Expand All @@ -22,6 +20,8 @@ typedef _Py_SourceLocation location;

#include "clinic/instruction_sequence.c.h"

#include <stdbool.h>

#undef SUCCESS
#undef ERROR
#define SUCCESS 0
Expand Down
Loading