One function

ParsedException in mahmoud/boltons

The author described this change as fix(tbutils): avoid IndexError in ParsedException.from_string on truncated tracebacks. It counts as a record because the check below fails on the code as it stood at 80f9eb429 and passes on 8a2a93d82, with nothing else changed between the two runs.

Fix saved2026-06-17
Sharing licenceBSD-2-Clause · LICENSE
Change size+5 4

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

Stores a parsed traceback and exception as would be typically output by :func:`sys.excepthook` or :func:`traceback.print_exception`. .. note: Does not currently store SyntaxError details such as column.

The change

105105
106106 frames = []
107107 line_no = start_line
108- while True:
108+ while line_no < len(tb_lines):
109109 frame_line = tb_lines[line_no].strip()
110110 frame_match = frame_re.match(frame_line)
111111 if frame_match:
128128 else:
129129 frame_dict['source_line'] = next_line_stripped
130130 line_no += 1
131- if _underline_re.match(tb_lines[line_no + 1]):
132- # To deal with anchors
133- line_no += 1
131+ if (line_no + 1 < len(tb_lines)
132+ and _underline_re.match(tb_lines[line_no + 1])):
133+ # To deal with anchors
134+ line_no += 1
134135 else:
135136 break
136137 line_no += 1

The check that tells the two apart

failpass·tests/test_tbutils_parsed_exc.py::test_parsed_exc_truncated

Check file tests/test_tbutils_parsed_exc.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 it80f9eb4296daadad85db5ef6c0fd14e2f3602fa4
Broken version dated2026-06-17
Moduleboltons.tbutils
Units changedParsedException
Fingerprint1d74283a2593e7f5
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 mahmoud/boltons