Skip to content

Fix empty SPPF node from xearley ignore carry-over (fixes #1598)#1601

Merged
erezsh merged 1 commit into
masterfrom
fix_issue1598
Jun 3, 2026
Merged

Fix empty SPPF node from xearley ignore carry-over (fixes #1598)#1601
erezsh merged 1 commit into
masterfrom
fix_issue1598

Conversation

@erezsh

@erezsh erezsh commented Jun 2, 2026

Copy link
Copy Markdown
Member

When an item in to_scan was carried over past an ignored sequence with item.node=None (e.g. a prediction at ptr=0 that hasn't matched anything yet), the carry-over still allocated an empty SymbolNode and stored it in node_cache. That empty node later became the left child of a PackedNode when the terminal was finally scanned, and crashed ForestSumVisitor with "max() iterable argument is empty".

Skip SymbolNode creation when item.node is None — there's nothing to merge, and new_item.node staying None makes the subsequent PackedNode have left=None, which is well-handled everywhere else.

When an item in to_scan was carried over past an ignored sequence with
item.node=None (e.g. a prediction at ptr=0 that hasn't matched anything
yet), the carry-over still allocated an empty SymbolNode and stored it
in node_cache. That empty node later became the left child of a
PackedNode when the terminal was finally scanned, and crashed
ForestSumVisitor with "max() iterable argument is empty".

Skip SymbolNode creation when item.node is None — there's nothing to
merge, and new_item.node staying None makes the subsequent PackedNode
have left=None, which is well-handled everywhere else.
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (eb015d1) to head (0aaca59).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1601   +/-   ##
=======================================
  Coverage   90.06%   90.06%           
=======================================
  Files          52       52           
  Lines        8089     8095    +6     
=======================================
+ Hits         7285     7291    +6     
  Misses        804      804           
Flag Coverage Δ
unittests 90.06% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chanicpanic chanicpanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erezsh erezsh merged commit 5718472 into master Jun 3, 2026
23 checks passed
@erezsh

erezsh commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

@chanicpanic Thanks!

Btw did you see this PR? I did it on a lark (hah) and I'm not sure it's correct. But the performance gains are substantial.

#1602

@chanicpanic

Copy link
Copy Markdown
Contributor

I did see that one. I'm not familiar with the details of Joop Leo, but perhaps it is time for me to learn :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants