From 20a1e2f3a1ac09f0da30c0dada5d35c18121049d Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Fri, 25 Sep 2026 22:20:07 +0530 Subject: [PATCH] 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) --- pythonbpf/type_deducer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonbpf/type_deducer.py b/pythonbpf/type_deducer.py index 8d0400e..1854b3d 100644 --- a/pythonbpf/type_deducer.py +++ b/pythonbpf/type_deducer.py @@ -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, }