Skip to content

Commit 870a038

Browse files
committed
Include <stdbool.h> & use bool rather than _Bool
1 parent 6e8a4de commit 870a038

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Modules/_ctypes/cfield.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "pycore_bitutils.h" // _Py_bswap32()
1212
#include "pycore_call.h" // _PyObject_CallNoArgs()
13+
#include <stdbool.h> // bool
1314

1415
#include <ffi.h>
1516
#include "ctypes.h"
@@ -522,7 +523,7 @@ v_get(void *ptr, Py_ssize_t size)
522523
return PyBool_FromLong((long)*(short int *)ptr);
523524
}
524525

525-
/* bool ('?'): _Bool */
526+
/* bool ('?'): bool (i.e. _Bool) */
526527
static PyObject *
527528
bool_set(void *ptr, PyObject *value, Py_ssize_t size)
528529
{
@@ -531,10 +532,10 @@ bool_set(void *ptr, PyObject *value, Py_ssize_t size)
531532
case -1:
532533
return NULL;
533534
case 0:
534-
*(_Bool *)ptr = 0;
535+
*(bool *)ptr = 0;
535536
_RET(value);
536537
default:
537-
*(_Bool *)ptr = 1;
538+
*(bool *)ptr = 1;
538539
_RET(value);
539540
}
540541
}
@@ -543,7 +544,7 @@ static PyObject *
543544
bool_get(void *ptr, Py_ssize_t size)
544545
{
545546
assert(NUM_BITS(size) || (size == sizeof(bool)));
546-
return PyBool_FromLong((long)*(_Bool *)ptr);
547+
return PyBool_FromLong((long)*(bool *)ptr);
547548
}
548549

549550
/* g: long double */

0 commit comments

Comments
 (0)