| 1543 | _Traceback = namedtuple('_Traceback', 'filename lineno function code_context index') |
| 1544 | |
| 1545 | class Traceback(_Traceback): |
| 1546 | def __new__(cls, filename, lineno, function, code_context, index, *, positions=None): |
| 1547 | instance = super().__new__(cls, filename, lineno, function, code_context, index) |
| 1548 | instance.positions = positions |
| 1549 | return instance |
| 1550 | |
| 1551 | def __repr__(self): |
| 1552 | return ('Traceback(filename={!r}, lineno={!r}, function={!r}, ' |
| 1553 | 'code_context={!r}, index={!r}, positions={!r})'.format( |
| 1554 | self.filename, self.lineno, self.function, self.code_context, |
| 1555 | self.index, self.positions)) |
| 1556 | |
| 1557 | def _get_code_position_from_tb(tb): |
| 1558 | code, instruction_index = tb.tb_frame.f_code, tb.tb_lasti |