Whole file
ilevkivskyi/com2ann
The author described this change as “Fix signature wrapping when return type contains commas (#21)”. It counts as a record because the check below fails on the code as it stood at bb8a37fa4 and passes on 46505e6bb, with nothing else changed between the two runs.
Projectilevkivskyi/com2ann
Fix saved2019-06-12
Sharing licenceMIT · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a save note
Fix signature wrapping when return type contains commas (#21)
The change
| 459 | 459 | parts: List[str] = [] | |
| 460 | 460 | next_part = '' | |
| 461 | 461 | nested = 0 | |
| 462 | + | complete = False # Did we split all the arguments inside (...)? | |
| 462 | 463 | indent: Optional[int] = None | |
| 463 | 464 | ||
| 464 | 465 | for i, c in enumerate(header): | |
| ⋯ | |||
| 468 | 469 | indent = i + 1 | |
| 469 | 470 | if c in ')]}': | |
| 470 | 471 | nested -= 1 | |
| 471 | - | if c == ',' and nested == 1: | |
| 472 | + | if not nested: | |
| 473 | + | complete = True | |
| 474 | + | if c == ',' and nested == 1 and not complete: | |
| 472 | 475 | next_part += c | |
| 473 | 476 | parts.append(next_part) | |
| 474 | 477 | next_part = '' | |
The check that tells the two apart
fail→pass·src/test_com2ann.py::FunctionTestCase::test_wrap_lines
Check file src/test_com2ann.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itbb8a37fa473060623ff4589b3cf3f4ebf4f1eb09
Broken version dated2019-06-11
Modulecom2ann
Units changedwrap_function_header
Fingerprintf3a14109e961132c
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in ilevkivskyi/com2ann
- 2025-06-02split_function_comment
- 2021-03-07process_assign
- 2019-06-12process_func_def
- 2019-06-12Fix keyword-only arguments (#23)
- 2019-06-11Fix crash when type comment appears on continuation line (#17)