@@ -1415,8 +1415,10 @@ for base_code, base_c_type in [
1415
1415
TABLE_ENTRY_SW (f , & ffi_type_float );
1416
1416
TABLE_ENTRY (v , & ffi_type_sshort ); /* vBOOL */
1417
1417
1418
- TABLE_ENTRY (c , FIXINT_FIELDDESC_FOR (char )-> pffi_type );
1419
- TABLE_ENTRY (u , FIXINT_FIELDDESC_FOR (wchar_t )-> pffi_type );
1418
+ // ctypes.c_char is signed for FFI, even where C wchar_t is unsigned.
1419
+ TABLE_ENTRY (c , _ctypes_fixint_fielddesc (sizeof (char ), true)-> pffi_type );
1420
+ // ctypes.c_wchar is signed for FFI, even where C wchar_t is unsigned.
1421
+ TABLE_ENTRY (u , _ctypes_fixint_fielddesc (sizeof (wchar_t ), true)-> pffi_type );
1420
1422
1421
1423
TABLE_ENTRY (s , & ffi_type_pointer );
1422
1424
TABLE_ENTRY (P , & ffi_type_pointer );
@@ -1434,7 +1436,8 @@ for base_code, base_c_type in [
1434
1436
1435
1437
/* bool has code '?', fill it in manually */
1436
1438
1437
- formattable .fmt_bool = * FIXINT_FIELDDESC_FOR (bool );
1439
+ // ctypes.c_bool is unsigned for FFI, even where C bool is signed.
1440
+ formattable .fmt_bool = * _ctypes_fixint_fielddesc (sizeof (bool ), false);
1438
1441
formattable .fmt_bool .code = '?' ;
1439
1442
formattable .fmt_bool .setfunc = bool_set ;
1440
1443
formattable .fmt_bool .getfunc = bool_get ;
0 commit comments