From e4e92710c09623fbbf2cd6f177b9cc8845df8356 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Mon, 6 Oct 2025 02:58:57 +0530 Subject: [PATCH] Move XDP pass above general return handling --- pythonbpf/functions/functions_pass.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pythonbpf/functions/functions_pass.py b/pythonbpf/functions/functions_pass.py index 7d86257..63a6aed 100644 --- a/pythonbpf/functions/functions_pass.py +++ b/pythonbpf/functions/functions_pass.py @@ -354,8 +354,11 @@ def handle_if( def handle_return(builder, stmt, local_sym_tab, ret_type): + logger.info(f"Handling return statement: {ast.dump(stmt)}") if stmt.value is None: return _handle_none_return(builder) + elif isinstance(stmt.value, ast.Name): + return _handle_xdp_return(stmt, builder, ret_type) elif ( isinstance(stmt.value, ast.Call) and isinstance(stmt.value.func, ast.Name) @@ -396,8 +399,6 @@ def handle_return(builder, stmt, local_sym_tab, ret_type): return True else: raise ValueError("Failed to evaluate return expression") - elif isinstance(stmt.value, ast.Name): - return _handle_xdp_return(stmt, builder, ret_type) else: raise ValueError("Unsupported return value")