[FIX] Do not crash on namespaced validators in argument blocks#347
Draft
ehennestad wants to merge 1 commit into
Draft
[FIX] Do not crash on namespaced validators in argument blocks#347ehennestad wants to merge 1 commit into
ehennestad wants to merge 1 commit into
Conversation
A function argument validated by a namespaced function with two or more
name parts and no size/class specifier (e.g. {a.b.validator}) is wrapped
in an ERROR node by the grammar, so the argument-block query yields no
parsed arguments and _parse_argument_section raised:
TypeError: 'NoneType' object is not iterable
Guard against the None capture and skip the block, mirroring the existing
handling in _parse_property_section. The build now completes; the
unparseable argument simply contributes no metadata.
This is a robustness fix. Correctly parsing such validators requires a
fix in the tree-sitter-matlab grammar itself.
Refs sphinx-contrib#335
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A function argument validated by a namespaced function with two or more name parts and no size/class specifier crashes the build:
The grammar wraps such an argument in an
ERRORnode, so the argument-block query produces no(property)captures andargsisNone.Change
Guard against the
Nonecapture in_parse_argument_sectionand skip the block, mirroring the existing guard in_parse_property_section. The build completes; the unparseable argument simply contributes no metadata (which is not rendered in function output anyway).Adds a regression test (
f_with_namespaced_validator_argument) that crashes without the guard.Scope
This is a robustness fix — it stops the crash. Correctly parsing these validators requires a fix in the
tree-sitter-matlabgrammar itself, so this only refs (does not close) the issue.Refs #335