From d1055e4d411ed8279239c81692fb034f990f9018 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Mon, 6 Oct 2025 22:20:54 +0530 Subject: [PATCH] Reduce a condition from handle_cond --- pythonbpf/functions/functions_pass.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pythonbpf/functions/functions_pass.py b/pythonbpf/functions/functions_pass.py index 18904ec..f31d48e 100644 --- a/pythonbpf/functions/functions_pass.py +++ b/pythonbpf/functions/functions_pass.py @@ -242,9 +242,7 @@ def handle_assign( def handle_cond(func, module, builder, cond, local_sym_tab, map_sym_tab): if isinstance(cond, ast.Constant): - if isinstance(cond.value, bool): - return ir.Constant(ir.IntType(1), int(cond.value)) - elif isinstance(cond.value, int): + if isinstance(cond.value, bool) or isinstance(cond.value, int): return ir.Constant(ir.IntType(1), int(bool(cond.value))) else: logger.info("Unsupported constant type in condition")