Commit f365bdf
committed
Fix traceback.FrameSummary's "line" parameter
traceback.FrameSummary's "line" parameter is a string that is the text
of a line of code, not an int that is the line number of a line of
code.
Also relax type of traceback.format_list's "extracted_list" parameter
in 3.5-and-later from List[FrameSummary] to Iterable[FrameSummary].
Never ask for a List when asking for a Sequence will do, and never ask
for a Sequence when asking for a Collection will do, and never ask for
a Collection when asking for an Iterable will do (and so on in other
cases, but this case stops at Iterable).
Also add a note about deliberately not supporting for type-checking
purposes the 3.4-and-earlier List[Tuple[str, int, str, Optional[str]]]
semantics for traceback.format_list's "extracted_list" parameter. The
traceback module currently supports the old type of parameter, but if
authors are typechecking their 3.5-and-later code, it's reasonable to
expect that they'll want to modernize their code to use FrameSummary
objects rather than four-tuples.1 parent c968124 commit f365bdf
1 file changed
+8
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
93 | | - | |
94 | | - | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
0 commit comments