From 189526d5ca9bbec0f75a4efe6a150b1e52a0e429 Mon Sep 17 00:00:00 2001 From: varun-r-mallya Date: Thu, 27 Nov 2025 12:42:10 +0530 Subject: [PATCH] format chore --- pythonbpf/allocation_pass.py | 8 ++++++-- pythonbpf/expr/expr_pass.py | 15 ++++++++------- tests/failing_tests/xdp/xdp_test_1.py | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pythonbpf/allocation_pass.py b/pythonbpf/allocation_pass.py index 9f5cb20..9099ced 100644 --- a/pythonbpf/allocation_pass.py +++ b/pythonbpf/allocation_pass.py @@ -117,7 +117,9 @@ def _allocate_for_call( if len(rval.args) == 0: # Zero-arg constructor: allocate the struct itself var = builder.alloca(struct_info.ir_type, name=var_name) - local_sym_tab[var_name] = LocalSymbol(var, struct_info.ir_type, call_type) + local_sym_tab[var_name] = LocalSymbol( + var, struct_info.ir_type, call_type + ) logger.info(f"Pre-allocated {var_name} for struct {call_type}") else: # Pointer cast: allocate as pointer to struct @@ -125,7 +127,9 @@ def _allocate_for_call( var = builder.alloca(ptr_type, name=var_name) var.align = 8 local_sym_tab[var_name] = LocalSymbol(var, ptr_type, call_type) - logger.info(f"Pre-allocated {var_name} for struct pointer cast to {call_type}") + logger.info( + f"Pre-allocated {var_name} for struct pointer cast to {call_type}" + ) elif VmlinuxHandlerRegistry.is_vmlinux_struct(call_type): # When calling struct_name(pointer), we're doing a cast, not construction diff --git a/pythonbpf/expr/expr_pass.py b/pythonbpf/expr/expr_pass.py index f52e924..d741459 100644 --- a/pythonbpf/expr/expr_pass.py +++ b/pythonbpf/expr/expr_pass.py @@ -682,13 +682,13 @@ def _handle_vmlinux_cast( def _handle_user_defined_struct_cast( - func, - module, - builder, - expr, - local_sym_tab, - map_sym_tab, - structs_sym_tab, + func, + module, + builder, + expr, + local_sym_tab, + map_sym_tab, + structs_sym_tab, ): """Handle user-defined struct cast expressions like iphdr(nh). @@ -744,6 +744,7 @@ def _handle_user_defined_struct_cast( return casted_ptr, struct_name + # ============================================================================ # Expression Dispatcher # ============================================================================ diff --git a/tests/failing_tests/xdp/xdp_test_1.py b/tests/failing_tests/xdp/xdp_test_1.py index b15414e..bda7664 100644 --- a/tests/failing_tests/xdp/xdp_test_1.py +++ b/tests/failing_tests/xdp/xdp_test_1.py @@ -6,6 +6,7 @@ from vmlinux import ( from pythonbpf import bpf, section, bpfglobal, compile, compile_to_ir, struct from ctypes import c_int64, c_ubyte, c_ushort, c_uint32 + @bpf @struct class iphdr: @@ -19,6 +20,7 @@ class iphdr: saddr: c_uint32 daddr: c_uint32 + @bpf @section("xdp") def ip_detector(ctx: struct_xdp_md) -> c_int64: