From 8cf0d201755a3854e30ab0a6c2eb58bb74790d60 Mon Sep 17 00:00:00 2001 From: Tucker Beck Date: Fri, 10 Apr 2026 14:35:17 -0700 Subject: [PATCH] fix: widen base exception --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- src/buzz/tools.py | 8 ++++---- uv.lock | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd4b5d..f07b6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## v8.1.1 - 2026-04-10 + +* Widened type hint for `ignore_exc_class` and `handle_exc_class` to `BaseException` to eliminate type errors for + handlers catching `KeyboardInterrupt` and such. + + ## v8.1.0 - 2026-03-20 * Added `verify_literal()` method to verify a value is a memger of a literal group (and narrow type) diff --git a/pyproject.toml b/pyproject.toml index 75d9b7e..433a957 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "py-buzz" -version = "8.1.0" +version = "8.1.1" description = "\"That's not flying, it's falling with style\": Exceptions with extras" authors = [ {name = "Tucker Beck", email = "tucker.beck@gmail.com"} diff --git a/src/buzz/tools.py b/src/buzz/tools.py index 6db91e6..e666da6 100644 --- a/src/buzz/tools.py +++ b/src/buzz/tools.py @@ -471,8 +471,8 @@ def handle_errors( raise_exc_class: type[Exception] | None = Exception, raise_args: Iterable[Any] | None = None, raise_kwargs: Mapping[str, Any] | None = None, - handle_exc_class: type[Exception] | tuple[type[Exception], ...] = Exception, - ignore_exc_class: type[Exception] | tuple[type[Exception], ...] | None = None, + handle_exc_class: type[BaseException] | tuple[type[BaseException], ...] = Exception, + ignore_exc_class: type[BaseException] | tuple[type[BaseException], ...] | None = None, do_finally: NoArgCallback | None = None, do_except: DoExceptParamsCallback | None = None, do_else: NoArgCallback | None = None, @@ -579,8 +579,8 @@ async def handle_errors_async( raise_exc_class: type[Exception] | None = Exception, raise_args: Iterable[Any] | None = None, raise_kwargs: Mapping[str, Any] | None = None, - handle_exc_class: type[Exception] | tuple[type[Exception], ...] = Exception, - ignore_exc_class: type[Exception] | tuple[type[Exception], ...] | None = None, + handle_exc_class: type[BaseException] | tuple[type[BaseException], ...] = Exception, + ignore_exc_class: type[BaseException] | tuple[type[BaseException], ...] | None = None, do_finally: NoArgCallback | AsyncNoArgCallback | None = None, do_except: DoExceptParamsCallback | AsyncDoExceptParamsCallback | None = None, do_else: NoArgCallback | AsyncNoArgCallback | None = None, diff --git a/uv.lock b/uv.lock index d365b6f..5d59a57 100644 --- a/uv.lock +++ b/uv.lock @@ -914,7 +914,7 @@ wheels = [ [[package]] name = "py-buzz" -version = "8.1.0" +version = "8.1.1" source = { editable = "." } dependencies = [ { name = "typing-extensions" },