Whole file

terryyin/lizard

The author described this change as fix line counting with cpre. It counts as a record because the check below fails on the code as it stood at 2a165bdd1 and passes on e22583990, with nothing else changed between the two runs.

Fix saved2016-02-28
Sharing licenceMIT · LICENSE.txt
Change size+6 3

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

fix line counting with cpre

The change

2424 else_count -= last.count("#else")
2525 if last.startswith("#if"):
2626 break
27- elif not else_count:
28- if not (if_stack and if_stack[-1].startswith("#elif")):
29- yield token
27+ elif not else_count and not (
28+ if_stack and if_stack[-1].startswith("#elif")):
29+ yield token
30+ else:
31+ for _ in range(token.count('\n')):
32+ yield '\n'
3033
3134 if "c" not in reader.ext:
3235 return tokens

The check that tells the two apart

failpass·test/testCPreprocessorExtension.py::Test_end_2_end::test_line_counting

Check file test/testCPreprocessorExtension.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 it2a165bdd1cb1b318a15bf6b1bfdce8bcc32d70df
Broken version dated2016-02-28
Modulelizard_ext.lizardcpre
Units changedLizardExtension
Fingerprinta525242a3d7c9f6e
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 terryyin/lizard