summaryrefslogtreecommitdiff
path: root/python/mediumlevelil.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-07-12 21:45:43 -0400
committerGlenn Smith <glenn@vector35.com>2025-07-12 22:07:24 -0400
commit6592214139290634550860697116801883131153 (patch)
tree0ada0a799ffed83a7253cfdaf0c40f6c8b013d6a /python/mediumlevelil.py
parent8143954882881079807041861702046354507957 (diff)
Allow constructing MLILFunction with null LLILFunction/Function
Diffstat (limited to 'python/mediumlevelil.py')
-rw-r--r--python/mediumlevelil.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index a606ac0f..38256716 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -3307,15 +3307,18 @@ class MediumLevelILFunction:
if _arch is None:
_arch = _source_function.arch
else:
+ if low_level_il is None and source_func is None:
+ raise ValueError("IL functions must be created with an associated function or LLIL function")
+
if low_level_il is None:
- raise ValueError("MLIL functions must be created with an associated LLIL function")
- _source_function = low_level_il.source_function
- if _source_function is None:
- raise ValueError("IL functions must be created with an associated function")
+ _source_function = source_func
+ else:
+ _source_function = low_level_il.source_function
+
if _arch is None:
_arch = low_level_il.arch
func_handle = _source_function.handle
- llil_handle = low_level_il.handle
+ llil_handle = low_level_il.handle if low_level_il is not None else None
_handle = core.BNCreateMediumLevelILFunction(_arch.handle, func_handle, llil_handle)
assert _source_function is not None
assert _arch is not None