Commit 1b72427
committed
Fix bug in colon seeker for multiline docstrings in Py < 3.8
Multiline docstrings in Python versions prior to 3.8 require rewinding through the body to seek the opening of the multiline docstring, which is the line after the close of the function def. The previous logic contained an indexing bug where it rewound prematurely at the beginning. This wasn't a problem for multiline docstrings with more than one line of content, but if the multiline docstring is empty or contained only one file then this jumped over the opening of the docstring and just keeps rewinding until an unrelated triple quote is found (or even all the way around to the starting point).
This indexing has been adjusted & the comments changed to better explain the flow of the seeker.
Off-by-one errors, you'll never be safe.1 parent 94d61fc commit 1b72427
File tree
3 files changed
+23
-8
lines changed- flake8_annotations
- testing/test_cases
3 files changed
+23
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
334 | 332 | | |
335 | 333 | | |
| 334 | + | |
| 335 | + | |
336 | 336 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 337 | | |
341 | | - | |
| 338 | + | |
342 | 339 | | |
343 | 340 | | |
344 | 341 | | |
345 | 342 | | |
346 | 343 | | |
347 | 344 | | |
348 | | - | |
349 | 345 | | |
350 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
153 | 165 | | |
0 commit comments