Skip to content

Commit 7c7162b

Browse files
authored
ctypesgen: Add 'bool' to ctypes type map, needed for C23 (#5621)
1 parent 89a831d commit 7c7162b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

python/libgrass_interface_generator/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ Currently installed version:
2020
It is highly encouraged to report [upstreams](https://github.com/ctypesgen/ctypesgen)
2121
necessary patches for GRASS.
2222

23+
#### Add `bool` ctypes type map for C23 support
24+
25+
Add bool to ctypes type map. This change is needed for C23 support, where
26+
_Bool is not necessarily defined by default.
27+
28+
```diff
29+
--- python/libgrass_interface_generator/ctypesgen/ctypedescs.py.orig
30+
+++ python/libgrass_interface_generator/ctypesgen/ctypedescs.py
31+
@@ -58,6 +58,7 @@
32+
("__uint64", False, 0): "c_uint64",
33+
("__uint64_t", False, 0): "c_uint64",
34+
("_Bool", True, 0): "c_bool",
35+
+ ("bool", True, 0): "c_bool",
36+
}
37+
38+
ctypes_type_map_python_builtin = {
39+
```
40+
2341
#### Ctypes "unnamed structure member with 0 bit size"-patch
2442

2543
Using unnamed zero bit sized structure members, e.g.:

python/libgrass_interface_generator/ctypesgen/ctypedescs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
("__uint64", False, 0): "c_uint64",
5959
("__uint64_t", False, 0): "c_uint64",
6060
("_Bool", True, 0): "c_bool",
61+
("bool", True, 0): "c_bool",
6162
}
6263

6364
ctypes_type_map_python_builtin = {

0 commit comments

Comments
 (0)