One function

Transformer_NonRecursive in lark-parser/lark

The author described this change as Fix for #826 (Thanks @mikeiovine) + stubs + tests. It counts as a record because the check below fails on the code as it stood at 3e7e66eb8 and passes on 7f795e827, with nothing else changed between the two runs.

Fix saved2021-02-05
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

2727 else:
2828 args = []
2929 stack.append(self._call_userfunc(x, args))
30+ elif self.__visit_tokens__ and isinstance(x, Token):
31+ stack.append(self._call_userfunc_token(x))
3032 else:
3133 stack.append(x)
3234

The check that tells the two apart

failpass·tests/test_trees.py::TestTrees::test_transformer_variants

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 it3e7e66eb8e06cd77fcc1712aeffcb9b86db09290
Broken version dated2021-01-27
Modulelark.visitors
Units changedTransformer_NonRecursive
Fingerprinta941355eb618f070
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