Repository navigation
Commit fc4a7c6
committed
Fix allcaptures()/allspans() return type in regex stubs
Both were typed as fixed one-element tuples, tuple[list[AnyStr]] and
tuple[list[tuple[int, int]]], even though the runtime always returns
one entry per capture group, a count that varies with the pattern.
A type checker refuses to unpack or index past the first element of a
fixed-length tuple, so any code doing that against the real, variable
return value failed to type-check even though it ran correctly.
Changed both to the variable-length tuple form, matching what the
neighboring captures() method already uses for the same shape.
Fixes #5661 parent dcc366e commit fc4a7c6
2 files changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | | - | |
750 | | - | |
| 749 | + | |
| 750 | + | |
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| |||
0 commit comments