Return a list of (frame, lineno) in a stack trace and a size. List starts with original calling frame, if there is one. Size may be number of frames above or below f.
(self, f, t)
| 820 | # to get a data structure representing a stack trace. |
| 821 | |
| 822 | def get_stack(self, f, t): |
| 823 | """Return a list of (frame, lineno) in a stack trace and a size. |
| 824 | |
| 825 | List starts with original calling frame, if there is one. |
| 826 | Size may be number of frames above or below f. |
| 827 | """ |
| 828 | stack = [] |
| 829 | if t and t.tb_frame is f: |
| 830 | t = t.tb_next |
| 831 | while f is not None: |
| 832 | stack.append((f, f.f_lineno)) |
| 833 | if f is self.botframe: |
| 834 | break |
| 835 | f = f.f_back |
| 836 | stack.reverse() |
| 837 | i = max(0, len(stack) - 1) |
| 838 | while t is not None: |
| 839 | stack.append((t.tb_frame, t.tb_lineno)) |
| 840 | t = t.tb_next |
| 841 | if f is None: |
| 842 | i = max(0, len(stack) - 1) |
| 843 | return stack, i |
| 844 | |
| 845 | def format_stack_entry(self, frame_lineno, lprefix=': '): |
| 846 | """Return a string with information about a stack entry. |