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/downloadprovider.py | |
| parent | c08cf3f1eaa73a5171c27044100479998104d58a (diff) | |
[Python API] Replace bare "except:" with "except Exception:" to fix signal propagation
Diffstat (limited to 'python/downloadprovider.py')
| -rw-r--r-- | python/downloadprovider.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/python/downloadprovider.py b/python/downloadprovider.py index c677b134..8576ae81 100644 --- a/python/downloadprovider.py +++ b/python/downloadprovider.py @@ -75,13 +75,13 @@ class DownloadInstance(object): if self in self.__class__._registered_instances: self.__class__._registered_instances.remove(self) self.perform_destroy_instance() - except: + except Exception: log_error_for_exception("Unhandled Python exception in DownloadInstance._destroy_instance") def _perform_request(self, ctxt, url): try: return self.perform_request(url) - except: + except Exception: log_error_for_exception("Unhandled Python exception in DownloadInstance._perform_request") return -1 @@ -136,7 +136,7 @@ class DownloadInstance(object): else: out_response[0] = None return 0 if py_response is not None else -1 - except: + except Exception: out_response[0] = None log_error_for_exception("Unhandled Python exception in DownloadInstance._perform_custom_request") return -1 @@ -168,7 +168,7 @@ class DownloadInstance(object): self._data = self._data[bytes_len:] return bytes_len - except: + except Exception: log_error_for_exception("Unhandled Python exception in DownloadInstance._read_callback") return 0 @@ -177,7 +177,7 @@ class DownloadInstance(object): str_bytes = ctypes.string_at(data, len) self._response = self._response + str_bytes return len - except: + except Exception: log_error_for_exception("Unhandled Python exception in DownloadInstance._write_callback") return 0 @@ -314,7 +314,7 @@ class DownloadProvider(metaclass=_DownloadProviderMetaclass): download_instance = core.BNNewDownloadInstanceReference(result.handle) assert download_instance is not None, "core.BNNewDownloadInstanceReference returned None" return ctypes.cast(download_instance, ctypes.c_void_p).value - except: + except Exception: log_error_for_exception("Unhandled Python exception in DownloadProvider._create_instance") return None @@ -332,7 +332,7 @@ try: if sys.platform != "win32": try: from requests import pyopenssl # type: ignore - except: + except Exception: pass elif core.BNIsUIEnabled(): try: @@ -365,7 +365,7 @@ try: # TODO FIXME remove asap when windows patch/hotfix (hopefully) gets released import _ssl _ssl.RAND_status() - except: + except Exception: pass class PythonDownloadInstance(DownloadInstance): @@ -403,7 +403,7 @@ try: except requests.RequestException as e: core.BNSetErrorForDownloadInstance(self.handle, e.__class__.__name__) return -1 - except: + except Exception: core.BNSetErrorForDownloadInstance(self.handle, "Unknown Exception!") log_error_for_exception("Unhandled Python exception in PythonDownloadInstance.perform_request") return -1 @@ -506,7 +506,7 @@ if not _loaded and (sys.platform != "win32"): core.BNSetErrorForDownloadInstance(self.handle, e.__class__.__name__) log_error_for_exception(str(e)) return -1 - except: + except Exception: core.BNSetErrorForDownloadInstance(self.handle, "Unknown Exception!") log_error_for_exception("Unhandled Python exception in PythonDownloadInstance.perform_request") return -1 |
