One function
Transformer_NonRecursive in lark-parser/lark
The author described this change as “Fix Transformer_NonRecursive crashing with ValueError when root is discarded”. It counts as a record because the check below fails on the code as it stood at c169b26a5 and passes on 42057206b, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2026-06-24
Sharing licenceMIT · LICENSE
Change size+2 −0
What the code was meant to do, written into the code itself as a docstring
Same as Transformer but non-recursive. Like Transformer, it doesn't change the original tree. Useful for huge trees.
The change
| 38 | 38 | else: | |
| 39 | 39 | stack.append(x) | |
| 40 | 40 | ||
| 41 | + | if not stack: | |
| 42 | + | return None # type: ignore[return-value] | |
| 41 | 43 | result, = stack # We should have only one tree remaining | |
| 42 | 44 | # There are no guarantees on the type of the value produced by calling a user func for a | |
| 43 | 45 | # child will produce. This means type system can't statically know that the final result is |
The check that tells the two apart
fail→pass·tests/test_trees.py::TestTrees::test_transformer_discard_root
Check file tests/test_trees.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 itc169b26a5bec9d47e590bf4be83691bcbdfe7b6b
Broken version dated2026-06-04
Modulelark.visitors
Units changedTransformer_NonRecursive
Fingerprint913badfe235034f6
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 lark-parser/lark
- 2026-07-08Fix lexer_callbacks silently dropped for keyword terminals
- 2026-06-04Raise GrammarError for non-terminal names in %declare
- 2026-06-02Fix empty SPPF node from xearley ignore carry-over (fixes #1598)
- 2026-05-24fix: raise GrammarError for template usage inside terminals
- 2024-10-25Adjust behaviour in #1481 to raise a NotImplementedError
- 2024-10-25Fix Symbol.__eq__ (fixes #1476)