One function

split_function_comment in ilevkivskyi/com2ann

The author described this change as Fix crash on invalid type comment (#65). It counts as a record because the check below fails on the code as it stood at 5497d7aa7 and passes on 24a47720d, with nothing else changed between the two runs.

Fix saved2025-06-02
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Split function type comment into argument types and return types. This also removes any additional sub-comment. For example: # type: (int, str) -> None # some explanation is transformed into: ['int', 'str'], 'None'.

The change

1010 is transformed into: ['int', 'str'], 'None'.
1111 """
1212 typ, _ = split_sub_comment(comment)
13- if "->" not in typ:
13+ if typ.count("->") != 1:
1414 if not silent:
1515 print("Invalid function type comment:", comment, file=sys.stderr)
1616 return None

The check that tells the two apart

failpass·src/test_com2ann.py::FunctionTestCase::test_invalid_return_type

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 it5497d7aa77190c05331bf8ba205b94904d34d010
Broken version dated2025-06-02
Modulecom2ann
Units changedsplit_function_comment
Fingerprint1f881a956841fe4f
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