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)
| 829 | # to get a data structure representing a stack trace. |
| 830 | |
| 831 | def get_stack(self, f, t): |
| 832 | """Return a list of (frame, lineno) in a stack trace and a size. |
| 833 | |
| 834 | List starts with original calling frame, if there is one. |
| 835 | Size may be number of frames above or below f. |
| 836 | """ |
| 837 | stack = [] |
| 838 | if t and t.tb_frame is f: |
| 839 | t = t.tb_next |
| 840 | while f is not None: |
| 841 | stack.append((f, f.f_lineno)) |
| 842 | if f is self.botframe: |
| 843 | break |
| 844 | f = f.f_back |
| 845 | stack.reverse() |
| 846 | i = max(0, len(stack) - 1) |
| 847 | while t is not None: |
| 848 | stack.append((t.tb_frame, t.tb_lineno)) |
| 849 | t = t.tb_next |
| 850 | if f is None: |
| 851 | i = max(0, len(stack) - 1) |
| 852 | return stack, i |
| 853 | |
| 854 | def format_stack_entry(self, frame_lineno, lprefix=': '): |
| 855 | """Return a string with information about a stack entry. |