From b7c0295e1a5186214fa6919f15dfaf379681e8e5 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 17 Jun 2024 17:12:34 +0200 Subject: [PATCH] use runtime union for EXCEPTION_OR_MORE --- src/_pytest/_code/code.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index 750195b94..229c7deee 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -30,7 +30,10 @@ from typing import overload from typing import Pattern from typing import Sequence from typing import SupportsIndex +from typing import Tuple +from typing import Type from typing import TypeVar +from typing import Union import pluggy @@ -53,9 +56,7 @@ if sys.version_info < (3, 11): TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] -EXCEPTION_OR_MORE = type[Exception] | tuple[type[Exception], ...] - -type_alias = type # to sidestep shadowing +EXCEPTION_OR_MORE = Union[Type[Exception], Tuple[Type[Exception], ...]] class Code: