Pegen improperly memoizes loop rules #102416
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Bug report
In the following part of pegen, the memoized result is only used if
self._should_memoize(node)
is true. Since loop rules are autogenerated, they are not marked with(memo)
, so this is always false. Despite that, in the end the result is memoized based on the different conditionif node.name
. Because of that, in the generated parser loop rules' results are always stored in the cache, but never accessed later.cpython/Tools/peg_generator/pegen/c_generator.py
Lines 608 to 647 in 8de59c1
Your environment
Does not matter - discovered through manual code analysis
The text was updated successfully, but these errors were encountered: