From a70c8e64ab1d2952721517a20ff7bf180850ada1 Mon Sep 17 00:00:00 2001 From: Reagan Lee <96998476+reaganjlee@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:26:34 -0700 Subject: [PATCH] Fix `errisinstance` typing (#12700) Fixes #12667 (cherry picked from commit cb98538e9c2ba3c65baf07432229d97fd5a29657) --- changelog/12667.bugfix.rst | 1 + src/_pytest/_code/code.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/12667.bugfix.rst diff --git a/changelog/12667.bugfix.rst b/changelog/12667.bugfix.rst new file mode 100644 index 00000000000..eceee86cb53 --- /dev/null +++ b/changelog/12667.bugfix.rst @@ -0,0 +1 @@ +Fixed a regression where type change in `ExceptionInfo.errisinstance` caused `mypy` to fail. diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index e7452825756..8fac39ea298 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -56,7 +56,7 @@ TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] -EXCEPTION_OR_MORE = Union[Type[Exception], Tuple[Type[Exception], ...]] +EXCEPTION_OR_MORE = Union[Type[BaseException], Tuple[Type[BaseException], ...]] class Code: