MCPcopy Index your code
hub / github.com/RustPython/RustPython / print_exception

Function print_exception

Lib/traceback.py:119–134  ·  view source on GitHub ↗

Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if

(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
                    file=None, chain=True, **kwargs)

Source from the content-addressed store, hash-verified

117
118
119def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
120 file=None, chain=True, **kwargs):
121 """Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
122
123 This differs from print_tb() in the following ways: (1) if
124 traceback is not None, it prints a header "Traceback (most recent
125 call last):"; (2) it prints the exception type and value after the
126 stack trace; (3) if type is SyntaxError and value has the
127 appropriate format, it prints the line where the syntax error
128 occurred with a caret on the next line indicating the approximate
129 position of the error.
130 """
131 colorize = kwargs.get("colorize", False)
132 value, tb = _parse_value_tb(exc, value, tb)
133 te = TracebackException(type(value), value, tb, limit=limit, compact=True)
134 te.print(file=file, chain=chain, colorize=colorize)
135
136
137BUILTIN_EXCEPTION_LIMIT = object()

Callers 4

log_exceptionMethod · 0.90
_print_exception_bltinFunction · 0.85
print_excFunction · 0.85
print_lastFunction · 0.85

Calls 4

printMethod · 0.95
_parse_value_tbFunction · 0.85
TracebackExceptionClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected