| 1633 | _Traceback = namedtuple('_Traceback', 'filename lineno function code_context index') |
| 1634 | |
| 1635 | class Traceback(_Traceback): |
| 1636 | def __new__(cls, filename, lineno, function, code_context, index, *, positions=None): |
| 1637 | instance = super().__new__(cls, filename, lineno, function, code_context, index) |
| 1638 | instance.positions = positions |
| 1639 | return instance |
| 1640 | |
| 1641 | def __repr__(self): |
| 1642 | return ('Traceback(filename={!r}, lineno={!r}, function={!r}, ' |
| 1643 | 'code_context={!r}, index={!r}, positions={!r})'.format( |
| 1644 | self.filename, self.lineno, self.function, self.code_context, |
| 1645 | self.index, self.positions)) |
| 1646 | |
| 1647 | def _get_code_position_from_tb(tb): |
| 1648 | code, instruction_index = tb.tb_frame.f_code, tb.tb_lasti |