diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index 750195b94e9..2bbf59b26cc 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -30,7 +30,10 @@ 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,7 +56,7 @@ TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] -EXCEPTION_OR_MORE = type[Exception] | tuple[type[Exception], ...] +EXCEPTION_OR_MORE = Union[Type[Exception], Tuple[Type[Exception], ...]] type_alias = type # to sidestep shadowing