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`.
--- /dev/null
+Ensure that ``Python.h`` is included before ``stdbool.h`` unless ``pyconfig.h``
+is included before or in some platform-specific contexts.
# define Py_BUILD_CORE_MODULE 1
#endif
-#include <stdbool.h>
#include "Python.h"
#include "pycore_hashtable.h"
#include "pycore_strhex.h" // _Py_strhex()
#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"
-#include <stdbool.h>
-
#include <Python.h>
#include "pycore_bytesobject.h" // _PyBytes_DecodeEscape()
#include "pycore_unicodeobject.h" // _PyUnicode_DecodeUnicodeEscapeInternal()
#include "pegen.h"
#include "string_parser.h"
+#include <stdbool.h>
+
//// STRING HANDLING FUNCTIONS ////
static int
* objects.
*/
-#include <stdbool.h>
-
#include "Python.h"
#include "opcode.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
#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
-
-#include <stdbool.h>
-
#include "Python.h"
#include "opcode.h"
#include "pycore_flowgraph.h"
#include "pycore_opcode_utils.h"
#include "pycore_opcode_metadata.h" // OPCODE_HAS_ARG, etc
+#include <stdbool.h>
+
#undef SUCCESS
#undef ERROR
-#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
*/
-#include <stdbool.h>
-
#include "Python.h"
#include "pycore_compile.h" // _PyCompile_EnsureArrayLargeEnough
#include "clinic/instruction_sequence.c.h"
+#include <stdbool.h>
+
#undef SUCCESS
#undef ERROR
#define SUCCESS 0