MCPcopy Index your code
hub / github.com/ipython/ipython / structured_traceback

Method structured_traceback

IPython/core/ultratb.py:1306–1330  ·  view source on GitHub ↗
(
        self,
        etype: type,
        evalue: BaseException | None,
        etb: TracebackType | None = None,
        tb_offset: int | None = None,
        context: int = 5,
    )

Source from the content-addressed store, hash-verified

1304 super().__call__(etype, value, elist)
1305
1306 def structured_traceback(
1307 self,
1308 etype: type,
1309 evalue: BaseException | None,
1310 etb: TracebackType | None = None,
1311 tb_offset: int | None = None,
1312 context: int = 5,
1313 ) -> list[str]:
1314 value = evalue
1315 # If the source file has been edited, the line in the syntax error can
1316 # be wrong (retrieved from an outdated cache). This replaces it with
1317 # the current value.
1318 if (
1319 isinstance(value, SyntaxError)
1320 and isinstance(value.filename, str)
1321 and isinstance(value.lineno, int)
1322 ):
1323 linecache.checkcache(value.filename)
1324 newtext = linecache.getline(value.filename, value.lineno)
1325 if newtext:
1326 value.text = newtext
1327 self.last_syntax_error = value
1328 return super(SyntaxTB, self).structured_traceback(
1329 etype, value, etb, tb_offset=tb_offset, context=context
1330 )
1331
1332 def clear_err_state(self) -> Any | None:
1333 """Return the current error state and clear it"""

Callers

nothing calls this directly

Calls 1

structured_tracebackMethod · 0.45

Tested by

no test coverage detected