allow reprcrash to be none in ReprExceptionInfo
* that this was not possible caused test_config.test_parse_warning_filter_failure to fail
This commit is contained in:
parent
7f95c9c3d7
commit
7b5bc36eab
|
@ -650,18 +650,13 @@ class ExceptionInfo(Generic[E]):
|
||||||
Added the ``chain`` parameter.
|
Added the ``chain`` parameter.
|
||||||
"""
|
"""
|
||||||
if style == "native":
|
if style == "native":
|
||||||
r = self._getreprcrash()
|
|
||||||
if r is None:
|
|
||||||
raise ValueError(
|
|
||||||
"There should always be a non-hidden traceback entry for the top level function."
|
|
||||||
)
|
|
||||||
return ReprExceptionInfo(
|
return ReprExceptionInfo(
|
||||||
reprtraceback=ReprTracebackNative(
|
reprtraceback=ReprTracebackNative(
|
||||||
traceback.format_exception(
|
traceback.format_exception(
|
||||||
self.type, self.value, self.traceback[0]._rawentry
|
self.type, self.value, self.traceback[0]._rawentry
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
reprcrash=r,
|
reprcrash=self._getreprcrash(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fmt = FormattedExcinfo(
|
fmt = FormattedExcinfo(
|
||||||
|
@ -1056,7 +1051,7 @@ class ExceptionChainRepr(ExceptionRepr):
|
||||||
@dataclasses.dataclass(eq=False)
|
@dataclasses.dataclass(eq=False)
|
||||||
class ReprExceptionInfo(ExceptionRepr):
|
class ReprExceptionInfo(ExceptionRepr):
|
||||||
reprtraceback: "ReprTraceback"
|
reprtraceback: "ReprTraceback"
|
||||||
reprcrash: "ReprFileLocation"
|
reprcrash: Optional["ReprFileLocation"]
|
||||||
|
|
||||||
def toterminal(self, tw: TerminalWriter) -> None:
|
def toterminal(self, tw: TerminalWriter) -> None:
|
||||||
self.reprtraceback.toterminal(tw)
|
self.reprtraceback.toterminal(tw)
|
||||||
|
|
Loading…
Reference in New Issue