From c7c0662abf39b0e5bd9b2366bbdfa31cc0a7792c Mon Sep 17 00:00:00 2001 From: Benedikt Waibel Date: Sat, 21 Feb 2026 23:04:50 +0100 Subject: [PATCH 1/2] Replace NotImplemented in Architecture patch methods with default values or error. --- python/architecture.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/python/architecture.py b/python/architecture.py index 5057e36f8..57d36ffba 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -2400,7 +2400,7 @@ def assemble(self, code: str, addr: int = 0) -> bytes: b'\\x0f\\x84\\x04\\x00\\x00\\x00' >>> """ - return NotImplemented + raise NotImplementedError def is_never_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: """ @@ -2420,7 +2420,7 @@ def is_never_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: False >>> """ - return NotImplemented + return False def is_always_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: """ @@ -2441,7 +2441,7 @@ def is_always_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: False >>> """ - return NotImplemented + return False def is_invert_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: """ @@ -2461,7 +2461,7 @@ def is_invert_branch_patch_available(self, data: bytes, addr: int = 0) -> bool: False >>> """ - return NotImplemented + return False def is_skip_and_return_zero_patch_available(self, data: bytes, addr: int = 0) -> bool: """ @@ -2484,7 +2484,7 @@ def is_skip_and_return_zero_patch_available(self, data: bytes, addr: int = 0) -> False >>> """ - return NotImplemented + return False def is_skip_and_return_value_patch_available(self, data: bytes, addr: int = 0) -> bool: """ @@ -2505,7 +2505,7 @@ def is_skip_and_return_value_patch_available(self, data: bytes, addr: int = 0) - False >>> """ - return NotImplemented + return False def convert_to_nop(self, data: bytes, addr: int = 0) -> Optional[bytes]: """ @@ -2524,7 +2524,7 @@ def convert_to_nop(self, data: bytes, addr: int = 0) -> Optional[bytes]: b'\\x90\\x90' >>> """ - return NotImplemented + raise NotImplementedError def always_branch(self, data: bytes, addr: int = 0) -> Optional[bytes]: """ @@ -2546,7 +2546,7 @@ def always_branch(self, data: bytes, addr: int = 0) -> Optional[bytes]: (['jmp', ' ', '0x9'], 5) >>> """ - return NotImplemented + raise NotImplementedError def invert_branch(self, data: bytes, addr: int = 0) -> Optional[bytes]: """ @@ -2569,7 +2569,7 @@ def invert_branch(self, data: bytes, addr: int = 0) -> Optional[bytes]: (['jl', ' ', '0xa'], 6) >>> """ - return NotImplemented + raise NotImplementedError def skip_and_return_value(self, data: bytes, addr: int, value: int) -> Optional[bytes]: """ @@ -2588,7 +2588,7 @@ def skip_and_return_value(self, data: bytes, addr: int, value: int) -> Optional[ (['mov', ' ', 'eax', ', ', '0x0'], 5) >>> """ - return NotImplemented + raise NotImplementedError def register_calling_convention(self, cc: 'callingconvention.CallingConvention') -> None: """ From a8f76b82a40eb04e6af2ad98637293fb31beb380 Mon Sep 17 00:00:00 2001 From: Benedikt Waibel Date: Sat, 21 Feb 2026 23:45:09 +0100 Subject: [PATCH 2/2] Replace NotImplemented with NotImplementedError in other API base classes. --- python/fileaccessor.py | 6 +++--- python/filemetadata.py | 6 +++--- python/interaction.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/fileaccessor.py b/python/fileaccessor.py index b35a362c7..33c9b731f 100644 --- a/python/fileaccessor.py +++ b/python/fileaccessor.py @@ -35,13 +35,13 @@ def __init__(self): self._cb.write = self._cb.write.__class__(self._write) def get_length(self): - return NotImplemented + raise NotImplementedError def read(self, offset, length): - return NotImplemented + raise NotImplementedError def write(self, offset: int, data: bytes): - return NotImplemented + raise NotImplementedError def __len__(self): return self.get_length() diff --git a/python/filemetadata.py b/python/filemetadata.py index 23965ac9d..0d7949bca 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -70,13 +70,13 @@ def _navigate(self, ctxt: Any, view: ViewName, offset: int) -> bool: return False def get_current_view(self) -> str: - return NotImplemented + raise NotImplementedError def get_current_offset(self) -> int: - return NotImplemented + raise NotImplementedError def navigate(self, view: ViewName, offset: int) -> bool: - return NotImplemented + raise NotImplementedError class SaveSettings: diff --git a/python/interaction.py b/python/interaction.py index 9874d7127..25f607aaa 100644 --- a/python/interaction.py +++ b/python/interaction.py @@ -833,7 +833,7 @@ def show_report_collection(self, title, reports): pass def get_text_line_input(self, prompt, title): - return NotImplemented + raise NotImplementedError def get_int_input(self, prompt, title): while True: @@ -849,10 +849,10 @@ def get_address_input(self, prompt, title, view, current_address): return get_int_input(prompt, title) def get_choice_input(self, prompt, title, choices): - return NotImplemented + raise NotImplementedError def get_large_choice_input(self, prompt, title, choices): - return NotImplemented + raise NotImplementedError def get_open_filename_input(self, prompt, ext): return get_text_line_input(prompt, "Open File")