One function
process_func_def in ilevkivskyi/com2ann
The author described this change as “Quick fix for comment on a separate line (#24)”. It counts as a record because the check below fails on the code as it stood at 176c43e00 and passes on 01210de75, with nothing else changed between the two runs.
Projectilevkivskyi/com2ann
Fix saved2019-06-12
Sharing licenceMIT · LICENSE
Change size+7 −1
What the code was meant to do, written into the code itself as a docstring
Perform translation for an (async) function definition. This supports two main ways of adding type comments for argument: def one( arg, # type: Type ): def another(arg): # type: (Type) -> AnotherType
The change
| 31 | 31 | if re.search(TYPE_COM, lines[i]): | |
| 32 | 32 | lines[i] = strip_type_comment(lines[i]) | |
| 33 | 33 | if not lines[i].strip(): | |
| 34 | - | del lines[i] | |
| 34 | + | if i > ret_line: | |
| 35 | + | del lines[i] | |
| 36 | + | else: | |
| 37 | + | # Removing an empty line in argument list is unsafe, since it | |
| 38 | + | # can cause shuffling of following line numbers. | |
| 39 | + | # TODO: fina a cleaner fix. | |
| 40 | + | lines[i] = '' | |
| 35 | 41 | ||
| 36 | 42 | # Inserting return type is a bit dirty... | |
| 37 | 43 | if func_type.ret_type: |
The check that tells the two apart
fail→pass·src/test_com2ann.py::FunctionTestCase::test_next_line_comment
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 it176c43e00cf36cdeec0b428c18e4bd8801b2a60d
Broken version dated2019-06-12
Modulecom2ann
Units changedprocess_func_def
Fingerprintc5a54d874551fa35
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-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)