diff --git a/bindings/python/unicorn/unicorn_py2.py b/bindings/python/unicorn/unicorn_py2.py index e93ca962..0b9f560c 100644 --- a/bindings/python/unicorn/unicorn_py2.py +++ b/bindings/python/unicorn/unicorn_py2.py @@ -390,7 +390,7 @@ def _catch_hook_exception(func): """ try: return func(self, *args, **kwargs) - except Exception as e: + except BaseException as e: # If multiple hooks raise exceptions, just use the first one if self._hook_exception is None: self._hook_exception = e diff --git a/bindings/python/unicorn/unicorn_py3/unicorn.py b/bindings/python/unicorn/unicorn_py3/unicorn.py index f08e2914..4248f252 100644 --- a/bindings/python/unicorn/unicorn_py3/unicorn.py +++ b/bindings/python/unicorn/unicorn_py3/unicorn.py @@ -361,7 +361,7 @@ def uccallback(uc: Uc, functype: Type[_CFP]): def wrapper(handle: int, *args, **kwargs): try: return func(uc, *args, **kwargs) - except Exception as e: + except BaseException as e: # If multiple hooks raise exceptions, just use the first one if uc._hook_exception is None: uc._hook_exception = e