Skip to content

fix(lib): prevent finished_tree assertion failure#4176

Merged
amaanq merged 1 commit intotree-sitter:masterfrom
ribru17:parser_assert_fix
Feb 1, 2025
Merged

fix(lib): prevent finished_tree assertion failure#4176
amaanq merged 1 commit intotree-sitter:masterfrom
ribru17:parser_assert_fix

Conversation

@ribru17
Copy link
Contributor

@ribru17 ribru17 commented Feb 1, 2025

Problem: When resetting the parser during subtree balancing, an error is thrown:

parser.c:2198: ts_parser_parse: Assertion `self->finished_tree.ptr' failed.

Solution: Reset canceled_balancing to false in ts_parser_reset().

@ribru17
Copy link
Contributor Author

ribru17 commented Feb 1, 2025

Of course the error shows up right after release 🫠

@clason
Copy link
Contributor

clason commented Feb 1, 2025

That's ok, day-one patch releases are a tradition.

@amaanq
Copy link
Member

amaanq commented Feb 1, 2025

🤦 Thanks @ribru17

Can you move your test into the one above? A lot of it is redundant, we can just call reset and add the additional check

**Problem:** When resetting the parser during subtree balancing, an
error is thrown:

```
parser.c:2198: ts_parser_parse: Assertion `self->finished_tree.ptr' failed.
```

**Solution:** Reset `canceled_balancing` to false in
`ts_parser_reset()`.
@amaanq amaanq merged commit 9ad096e into tree-sitter:master Feb 1, 2025
19 checks passed
@ribru17 ribru17 deleted the parser_assert_fix branch February 2, 2025 04:34
@tree-sitter tree-sitter deleted a comment from mattyboyy32 Aug 14, 2025
@tree-sitter tree-sitter locked and limited conversation to collaborators Aug 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants