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.
Projectilevkivskyi/com2ann
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
| 10 | 10 | is transformed into: ['int', 'str'], 'None'. | |
| 11 | 11 | """ | |
| 12 | 12 | typ, _ = split_sub_comment(comment) | |
| 13 | - | if "->" not in typ: | |
| 13 | + | if typ.count("->") != 1: | |
| 14 | 14 | if not silent: | |
| 15 | 15 | print("Invalid function type comment:", comment, file=sys.stderr) | |
| 16 | 16 | return None |
The check that tells the two apart
fail→pass·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
- 2021-03-07process_assign
- 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)