diff options
| author | Josh Ferrell <josh@vector35.com> | 2026-04-15 11:21:40 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2026-04-15 11:21:44 -0400 |
| commit | b4ccb82ea76b98457d9dc59424632ca412511ed4 (patch) | |
| tree | 2eb4d7875181cee7b05413fa6dcdaea3a1d95981 /python/examples | |
| parent | c08cf3f1eaa73a5171c27044100479998104d58a (diff) | |
[Python API] Replace bare "except:" with "except Exception:" to fix signal propagation
Diffstat (limited to 'python/examples')
| -rw-r--r-- | python/examples/encoded_strings.py | 2 | ||||
| -rwxr-xr-x | python/examples/export_svg.py | 6 | ||||
| -rw-r--r-- | python/examples/mappedview.py | 2 | ||||
| -rw-r--r-- | python/examples/nds.py | 4 | ||||
| -rw-r--r-- | python/examples/nes.py | 2 | ||||
| -rw-r--r-- | python/examples/nsf.py | 2 | ||||
| -rw-r--r-- | python/examples/triage/byte.py | 2 | ||||
| -rw-r--r-- | python/examples/triage/view.py | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/python/examples/encoded_strings.py b/python/examples/encoded_strings.py index 691d116c..6c12f535 100644 --- a/python/examples/encoded_strings.py +++ b/python/examples/encoded_strings.py @@ -31,7 +31,7 @@ class EncodedStringRecognizer(StringRecognizer): try: values = bytes.fromhex(type.target.attributes[name]) decoder = self.__class__.decoders[name] - except: + except Exception: return None if values is None or decoder is None: return None diff --git a/python/examples/export_svg.py b/python/examples/export_svg.py index e9ce9299..f98b970e 100755 --- a/python/examples/export_svg.py +++ b/python/examples/export_svg.py @@ -97,14 +97,14 @@ def rgbStr(tokenType): '''Given a token string name, look up the theme color for it and return as rbg(x,y,z) str''' try: color = eval(f'getThemeColor(ThemeColor.{tokenType})') - except: + except Exception: color = None if (not color): try: ctx = UIContext.activeContext() view_frame = ctx.getCurrentViewFrame() color = eval(f'getTokenColor(view_frame, InstructionTextTokenType.{tokenType})') - except: + except Exception: return 'rgb(224, 224, 224)' r = color.getRgb()[0] g = color.getRgb()[1] @@ -301,7 +301,7 @@ def render_svg(function, offset, mode, form, showOpcodes, showAddresses, orignam rgb = colors[color_str] else: rgb = [bb.highlight.red, bb.highlight.green, bb.highlight.blue] - except: + except Exception: pass output += f' <rect class="basicblock" x="{x}" y="{y}" height="{height + 12}" width="{width + 16}" fill="rgb({rgb[0]},{rgb[1]},{rgb[2]})"/>\n' diff --git a/python/examples/mappedview.py b/python/examples/mappedview.py index 32963ea2..062f61da 100644 --- a/python/examples/mappedview.py +++ b/python/examples/mappedview.py @@ -143,7 +143,7 @@ class MappedView(BinaryView): # Note: This MappedView (Python) BinaryView implementation is incomplete. It ignores platform, section, and segment settings. # It's preferred that values saved in the settings system be imageBase agnostic. return True - except: + except Exception: log_error(traceback.format_exc()) return False diff --git a/python/examples/nds.py b/python/examples/nds.py index 7ca04e24..3c108c74 100644 --- a/python/examples/nds.py +++ b/python/examples/nds.py @@ -73,7 +73,7 @@ class DSView(BinaryView): ) self.add_entry_point(Architecture['armv7'].standalone_platform, self.arm_entry_addr) # type: ignore return True - except: + except Exception: log_error(traceback.format_exc()) return False @@ -90,7 +90,7 @@ class DSView(BinaryView): ) self.add_entry_point(Architecture['armv7'].standalone_platform, self.arm_entry_addr) # type: ignore return True - except: + except Exception: log_error(traceback.format_exc()) return False diff --git a/python/examples/nes.py b/python/examples/nes.py index da06bc30..ef786df4 100644 --- a/python/examples/nes.py +++ b/python/examples/nes.py @@ -691,7 +691,7 @@ class NESView(BinaryView): self.add_function(addr) return True - except: + except Exception: log_error(traceback.format_exc()) return False diff --git a/python/examples/nsf.py b/python/examples/nsf.py index 5b5f644d..2e183e1d 100644 --- a/python/examples/nsf.py +++ b/python/examples/nsf.py @@ -134,7 +134,7 @@ class NSFView(BinaryView): self.define_auto_symbol(Symbol(SymbolType.DataSymbol, 0x4017, "JOY2")) return True - except: + except Exception: log_error(traceback.format_exc()) return False diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py index 13e5d153..23e30c57 100644 --- a/python/examples/triage/byte.py +++ b/python/examples/triage/byte.py @@ -9,7 +9,7 @@ from binaryninjaui import View, ViewType, RenderContext, UIContext, UIAction from binaryninja.enums import LinearDisassemblyLineType, ThemeColor try: from binaryninja.binaryview import AddressRange -except: +except Exception: from binaryninja.function import AddressRange diff --git a/python/examples/triage/view.py b/python/examples/triage/view.py index 28a99a75..3a8b0e02 100644 --- a/python/examples/triage/view.py +++ b/python/examples/triage/view.py @@ -48,7 +48,7 @@ class TriageView(QScrollArea, View): hdr = headers.PEHeaders(self.data) elif self.data.view_type != "Raw": hdr = headers.GenericHeaders(self.data) - except: + except Exception: log.log_error(traceback.format_exc()) if hdr is not None: |
