Initialize from given python traceback object and ExceptionInfo.
(
self,
tb: Union[TracebackType, Iterable[TracebackEntry]],
excinfo: Optional["ReferenceType[ExceptionInfo[BaseException]]"] = None,
)
| 324 | """Traceback objects encapsulate and offer higher level access to Traceback entries.""" |
| 325 | |
| 326 | def __init__( |
| 327 | self, |
| 328 | tb: Union[TracebackType, Iterable[TracebackEntry]], |
| 329 | excinfo: Optional["ReferenceType[ExceptionInfo[BaseException]]"] = None, |
| 330 | ) -> None: |
| 331 | """Initialize from given python traceback object and ExceptionInfo.""" |
| 332 | self._excinfo = excinfo |
| 333 | if isinstance(tb, TracebackType): |
| 334 | |
| 335 | def f(cur: TracebackType) -> Iterable[TracebackEntry]: |
| 336 | cur_: Optional[TracebackType] = cur |
| 337 | while cur_ is not None: |
| 338 | yield TracebackEntry(cur_, excinfo=excinfo) |
| 339 | cur_ = cur_.tb_next |
| 340 | |
| 341 | super().__init__(f(tb)) |
| 342 | else: |
| 343 | super().__init__(tb) |
| 344 | |
| 345 | def cut( |
| 346 | self, |