Show More
@@ -763,7 +763,7 b' class VerboseTB(TBTools):' | |||
|
763 | 763 | self, |
|
764 | 764 | etype: type, |
|
765 | 765 | evalue: BaseException, |
|
766 | etb: TracebackType, | |
|
766 | etb: Optional[TracebackType], | |
|
767 | 767 | number_of_lines_of_context, |
|
768 | 768 | tb_offset: Optional[int], |
|
769 | 769 | ): |
@@ -772,7 +772,6 b' class VerboseTB(TBTools):' | |||
|
772 | 772 | This may be called multiple times by Python 3 exception chaining |
|
773 | 773 | (PEP 3134). |
|
774 | 774 | """ |
|
775 | assert etb is not None | |
|
776 | 775 | # some locals |
|
777 | 776 | orig_etype = etype |
|
778 | 777 | try: |
@@ -783,7 +782,9 b' class VerboseTB(TBTools):' | |||
|
783 | 782 | tb_offset = self.tb_offset if tb_offset is None else tb_offset |
|
784 | 783 | assert isinstance(tb_offset, int) |
|
785 | 784 | head = self.prepare_header(etype, self.long_header) |
|
786 | records = self.get_records(etb, number_of_lines_of_context, tb_offset) | |
|
785 | records = ( | |
|
786 | self.get_records(etb, number_of_lines_of_context, tb_offset) if etb else [] | |
|
787 | ) | |
|
787 | 788 | |
|
788 | 789 | frames = [] |
|
789 | 790 | skipped = 0 |
@@ -822,6 +823,7 b' class VerboseTB(TBTools):' | |||
|
822 | 823 | def get_records( |
|
823 | 824 | self, etb: TracebackType, number_of_lines_of_context: int, tb_offset: int |
|
824 | 825 | ): |
|
826 | assert etb is not None | |
|
825 | 827 | context = number_of_lines_of_context - 1 |
|
826 | 828 | after = context // 2 |
|
827 | 829 | before = context - after |
@@ -836,19 +838,17 b' class VerboseTB(TBTools):' | |||
|
836 | 838 | after=after, |
|
837 | 839 | pygments_formatter=formatter, |
|
838 | 840 | ) |
|
839 | assert etb is not None | |
|
840 | 841 | return list(stack_data.FrameInfo.stack_data(etb, options=options))[tb_offset:] |
|
841 | 842 | |
|
842 | 843 | def structured_traceback( |
|
843 | 844 | self, |
|
844 | 845 | etype: type, |
|
845 | 846 | evalue: Optional[BaseException], |
|
846 | etb: TracebackType, | |
|
847 | etb: Optional[TracebackType], | |
|
847 | 848 | tb_offset: Optional[int] = None, |
|
848 | 849 | number_of_lines_of_context: int = 5, |
|
849 | 850 | ): |
|
850 | 851 | """Return a nice text document describing the traceback.""" |
|
851 | assert etb is not None | |
|
852 | 852 | formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context, |
|
853 | 853 | tb_offset) |
|
854 | 854 |
General Comments 0
You need to be logged in to leave comments.
Login now