From 1c349c87b4141c03e9f823a9d01fdba6de6d68f0 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Fri, 7 Aug 2026 05:30:13 +0530 Subject: [PATCH] Core: Return the function-pointer check directly in _is_flattenable_scalar Style only, no behaviour change and no IR change. Keeps `ruff check --select SIM` clean on the files this branch touches. Co-Authored-By: Claude Opus 5 (1M context) --- pythonbpf/vmlinux_parser/class_handler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pythonbpf/vmlinux_parser/class_handler.py b/pythonbpf/vmlinux_parser/class_handler.py index c41a0f9..6e9febd 100644 --- a/pythonbpf/vmlinux_parser/class_handler.py +++ b/pythonbpf/vmlinux_parser/class_handler.py @@ -58,9 +58,10 @@ def _is_flattenable_scalar(member_type: Any) -> bool: return False if issubclass(member_type, (ctypes._Pointer, ctypes.Array)): return False - if hasattr(member_type, "_restype_") and hasattr(member_type, "_argtypes_"): - return False - return True + is_function_pointer = hasattr(member_type, "_restype_") and hasattr( + member_type, "_argtypes_" + ) + return not is_function_pointer def flatten_anonymous_members(class_obj, dep_node) -> None: