One function
process_assign in ilevkivskyi/com2ann
The author described this change as “Fix type comment left on separate continuation line after a type ignore of expression line (#35)”. It counts as a record because the check below fails on the code as it stood at ce7583b5a and passes on be67402d3, with nothing else changed between the two runs.
Projectilevkivskyi/com2ann
Fix saved2021-03-07
Sharing licenceMIT · LICENSE
Change size+2 −1
What the code was meant to do, written into the code itself as a docstring
Process type comment in an assignment statement. Remove the matching r.h.s. if drop_none or drop_ellipsis is True. For example: x = ... # type: int will be translated to x: int
The change
| 20 | 20 | # We perform the tasks in order from larger line/columns to smaller ones | |
| 21 | 21 | # to avoid shuffling the line column numbers in following code. | |
| 22 | 22 | # First remove the type comment. | |
| 23 | - | if re.search(TYPE_COM, lines[rv_end]): | |
| 23 | + | match = re.search(TYPE_COM, lines[rv_end]) | |
| 24 | + | if match and not match.group(1).lstrip().startswith('ignore'): | |
| 24 | 25 | lines[rv_end] = strip_type_comment(lines[rv_end]) | |
| 25 | 26 | else: | |
| 26 | 27 | # Special case: type comment moved to a separate continuation line. |
The check that tells the two apart
fail→pass·src/test_com2ann.py::AssignTestCase::test_continuation_using_parens
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 itce7583b5a98ee5b9dbeb8a8cef4239893e230291
Broken version dated2020-08-17
Modulecom2ann
Units changedprocess_assign
Fingerprintc4eb5bdf5460f21e
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
- 2019-06-12process_func_def
- 2019-06-12Fix keyword-only arguments (#23)
- 2019-06-12Fix signature wrapping when return type contains commas (#21)
- 2019-06-11Fix crash when type comment appears on continuation line (#17)