From 9b849ca14d335538b1c9919ca83f95dbaa8182fb Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 25 Jan 2022 00:07:27 -0500 Subject: [PATCH] FIX: Account form stdbool.h being included in Python.h As of CPython 3.11 (via https://github.com/python/cpython/pull/29883) stdbool.h is now included in Python.h so do attempt to redefine bool/true/false. --- ast27/Include/asdl.h | 2 ++ ast3/Python/ast.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ast27/Include/asdl.h b/ast27/Include/asdl.h index 2e5045b4..b8a5d2f2 100644 --- a/ast27/Include/asdl.h +++ b/ast27/Include/asdl.h @@ -8,8 +8,10 @@ typedef PyObject * string; typedef PyObject * object; #ifndef __cplusplus +#ifndef __bool_true_false_are_defined typedef enum {false, true} bool; #endif +#endif /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work diff --git a/ast3/Python/ast.c b/ast3/Python/ast.c index 60b8fdd4..b87a8604 100644 --- a/ast3/Python/ast.c +++ b/ast3/Python/ast.c @@ -13,9 +13,12 @@ #include // VS 2010 doesn't have ... +#ifndef __bool_true_false_are_defined typedef int bool; #define false 0 #define true 1 +#endif + #if PY_MINOR_VERSION < 6 static PyObject *