Skip to content

Commit

Permalink
FIX: Account form stdbool.h being included in Python.h
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tacaswell committed Jan 25, 2022
1 parent 7d9097f commit 9b849ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ast27/Include/asdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ast3/Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
#include <assert.h>

// VS 2010 doesn't have <stdbool.h>...
#ifndef __bool_true_false_are_defined
typedef int bool;
#define false 0
#define true 1
#endif


#if PY_MINOR_VERSION < 6
static PyObject *
Expand Down

0 comments on commit 9b849ca

Please sign in to comment.