Print out a formatted exception traceback. Optional arguments: - out: an open file-like object to direct output to. - tb_offset: the number of frames to skip over in the stack, on a per-call basis (this overrides temporarily the instance's tb_offset
(
self,
etype: type | None = None,
evalue: BaseException | None = None,
etb: TracebackType | None = None,
out: Any = None,
tb_offset: int | None = None,
)
| 1222 | """ |
| 1223 | |
| 1224 | def __call__( |
| 1225 | self, |
| 1226 | etype: type | None = None, |
| 1227 | evalue: BaseException | None = None, |
| 1228 | etb: TracebackType | None = None, |
| 1229 | out: Any = None, |
| 1230 | tb_offset: int | None = None, |
| 1231 | ) -> None: |
| 1232 | """Print out a formatted exception traceback. |
| 1233 | |
| 1234 | Optional arguments: |
| 1235 | - out: an open file-like object to direct output to. |
| 1236 | |
| 1237 | - tb_offset: the number of frames to skip over in the stack, on a |
| 1238 | per-call basis (this overrides temporarily the instance's tb_offset |
| 1239 | given at initialization time.""" |
| 1240 | |
| 1241 | if out is None: |
| 1242 | out = self.ostream |
| 1243 | out.flush() |
| 1244 | out.write(self.text(etype, evalue, etb, tb_offset)) # type:ignore[arg-type] |
| 1245 | out.write("\n") |
| 1246 | out.flush() |
| 1247 | # FIXME: we should remove the auto pdb behavior from here and leave |
| 1248 | # that to the clients. |
| 1249 | try: |
| 1250 | self.debugger() |
| 1251 | except KeyboardInterrupt: |
| 1252 | print("\nKeyboardInterrupt") |
| 1253 | |
| 1254 | def structured_traceback( |
| 1255 | self, |