Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit 36110cf

Browse files
authored
FIX: Account form stdbool.h being included in Python.h (#184)
As of CPython 3.11 (via python/cpython#29883) stdbool.h is now included in Python.h so do attempt to redefine bool/true/false.
1 parent 7d9097f commit 36110cf

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ast27/Include/asdl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ typedef PyObject * string;
88
typedef PyObject * object;
99

1010
#ifndef __cplusplus
11+
#ifndef __bool_true_false_are_defined
1112
typedef enum {false, true} bool;
1213
#endif
14+
#endif
1315

1416
/* It would be nice if the code generated by asdl_c.py was completely
1517
independent of Python, but it is a goal the requires too much work

ast3/Python/ast.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
#include <assert.h>
1414

1515
// VS 2010 doesn't have <stdbool.h>...
16+
#ifndef __bool_true_false_are_defined
1617
typedef int bool;
1718
#define false 0
1819
#define true 1
20+
#endif
21+
1922

2023
#if PY_MINOR_VERSION < 6
2124
static PyObject *

0 commit comments

Comments
 (0)