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)
| 126 | |
| 127 | |
| 128 | def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ |
| 129 | file=None, chain=True, **kwargs): |
| 130 | """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. |
| 131 | |
| 132 | This differs from print_tb() in the following ways: (1) if |
| 133 | traceback is not None, it prints a header "Traceback (most recent |
| 134 | call last):"; (2) it prints the exception type and value after the |
| 135 | stack trace; (3) if type is SyntaxError and value has the |
| 136 | appropriate format, it prints the line where the syntax error |
| 137 | occurred with a caret on the next line indicating the approximate |
| 138 | position of the error. |
| 139 | """ |
| 140 | colorize = kwargs.get("colorize", False) |
| 141 | value, tb = _parse_value_tb(exc, value, tb) |
| 142 | te = TracebackException(type(value), value, tb, limit=limit, compact=True) |
| 143 | te.print(file=file, chain=chain, colorize=colorize) |
| 144 | |
| 145 | |
| 146 | BUILTIN_EXCEPTION_LIMIT = object() |
no test coverage detected
searching dependent graphs…