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.

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

3131 if re.search(TYPE_COM, lines[i]):
3232 lines[i] = strip_type_comment(lines[i])
3333 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] = ''
3541
3642 # Inserting return type is a bit dirty...
3743 if func_type.ret_type:

The check that tells the two apart

failpass·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