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)
| 526 | # to get a data structure representing a stack trace. |
| 527 | |
| 528 | def get_stack(self, f, t): |
| 529 | """Return a list of (frame, lineno) in a stack trace and a size. |
| 530 | |
| 531 | List starts with original calling frame, if there is one. |
| 532 | Size may be number of frames above or below f. |
| 533 | """ |
| 534 | stack = [] |
| 535 | if t and t.tb_frame is f: |
| 536 | t = t.tb_next |
| 537 | while f is not None: |
| 538 | stack.append((f, f.f_lineno)) |
| 539 | if f is self.botframe: |
| 540 | break |
| 541 | f = f.f_back |
| 542 | stack.reverse() |
| 543 | i = max(0, len(stack) - 1) |
| 544 | while t is not None: |
| 545 | stack.append((t.tb_frame, t.tb_lineno)) |
| 546 | t = t.tb_next |
| 547 | if f is None: |
| 548 | i = max(0, len(stack) - 1) |
| 549 | return stack, i |
| 550 | |
| 551 | def format_stack_entry(self, frame_lineno, lprefix=': '): |
| 552 | """Return a string with information about a stack entry. |