Skip to content

Commit d38da9d

Browse files
committed
Fix MyPy
1 parent 39339b9 commit d38da9d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/_pytest/_code/code.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656

5757
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
5858

59-
ExceptionGroupTypes: tuple = ()
59+
ExceptionGroupTypes: Tuple[Any] = ()
6060
try:
61-
ExceptionGroupTypes += (ExceptionGroup,)
61+
ExceptionGroupTypes += (ExceptionGroup,) # type: ignore
6262
except NameError:
6363
pass # Is missing for `python<3.10`
6464
try:
@@ -68,7 +68,6 @@
6868
except ModuleNotFoundError:
6969
pass # No backport is installed
7070

71-
7271
class Code:
7372
"""Wrapper around Python code objects."""
7473

@@ -936,15 +935,15 @@ def repr_excinfo(
936935
while e is not None and id(e) not in seen:
937936
seen.add(id(e))
938937
if isinstance(e, ExceptionGroupTypes):
939-
reprtraceback = ReprTracebackNative(
938+
reprtraceback: Union[ReprTracebackNative, ReprTraceback] = ReprTracebackNative(
940939
traceback.format_exception(
941-
type(e), e, excinfo.traceback[0]._rawentry
940+
type(excinfo.value), excinfo.value, excinfo.traceback[0]._rawentry
942941
)
943942
)
944-
reprcrash = None
943+
reprcrash: Optional[ReprFileLocation] = None
945944
elif excinfo_:
946945
reprtraceback = self.repr_traceback(excinfo_)
947-
reprcrash: Optional[ReprFileLocation] = (
946+
reprcrash = (
948947
excinfo_._getreprcrash() if self.style != "value" else None
949948
)
950949
else:

0 commit comments

Comments
 (0)