mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
Core: Accept c_bool as a ctypes type
c_bool was missing from the ctypes table, so c_bool(5) was an unknown call, its slot was never allocated, and the error read "Undefined variable". It is C's _Bool: one bit, like the True/False locals, never negative, and a value narrows to it by comparing with zero, which the signedness rules already apply to 1-bit types. It works as a local, a struct field, a map value and a global; in BTF it is a one-byte _Bool. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -113,6 +113,9 @@ _INT_CTYPE_WIDTHS = {
|
||||
"c_longlong": 64,
|
||||
# A pointer-sized integer; treated as unsigned like uintptr_t.
|
||||
"c_void_p": 64,
|
||||
# C's _Bool: one bit to LLVM (as True/False locals already are). It is
|
||||
# never negative, and a value narrows to it by comparing with zero.
|
||||
"c_bool": 1,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user