One function

parse in kellyjonbrazil/jc

The author described this change as fix for unhandled lines in xrandr output. It counts as a record because the check below fails on the code as it stood at 3ca8e1ef1 and passes on 1da080dc5, with nothing else changed between the two runs.

Fix saved2024-03-23
Sharing licenceMIT · LICENSE.md
Change size+10 0

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

Main text parsing function Parameters: data: (string) text data to parse raw: (boolean) unprocessed output if True quiet: (boolean) suppress warning messages if True Returns: Dictionary. Raw or processed structured data.

The change

1919 lines = data.splitlines()
2020 screen, device = None, None
2121
22+ # temporary fix to ignore specific unhandled lines
23+ ignore_pattern = re.compile(r'^\s+(h|v):\s+(height|width)\s+\d+\s+start\s+\d+\s+end')
24+
2225 result: Response = {"screens": []}
2326 if jc.utils.has_data(data):
2427 while index < len(lines):
28+
29+ # temporary fix to ignore specific unhandled lines
30+ ignore_re = ignore_pattern.match(lines[index])
31+ if ignore_re:
32+ index += 1
33+ continue
34+
2535 line = _Line.categorize(lines[index])
2636 if line.t == LineType.Screen:
2737 screen = _parse_screen(line)

The check that tells the two apart

failpass·tests/test_xrandr.py::XrandrTests::test_issue_549

Check file tests/test_xrandr.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 it3ca8e1ef11bc011e726009f3e7db82869fbbd6b1
Broken version dated2024-03-19
Modulejc.parsers.xrandr
Units changedparse
Fingerprint6127505f459637bb
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 kellyjonbrazil/jc