Fix tree sitter commit#298
Open
jmgate wants to merge 4 commits into
Open
Conversation
When trying to test out the `master` branch against my project, to see
if we're ready for a 0.23.0 release, I ran into the following error:
File ".../sphinx/events.py", line 415, in emit
raise ExtensionError(
...<4 lines>...
) from exc
sphinx.errors.ExtensionError: Handler <function analyze at 0x...>
for event 'builder-inited' threw an exception (exception: list
index out of range)
Digging further, the problem was actually:
File ".../mat_tree_sitter_parser.py", line 373, in
_parse_argument_section
_, arg_match = q_arg.matches(arg)[0]
~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
I was able to rewind through history to find this problem first arose
with commit 4cd5c51. The problem is
occasionally `q_arg.matches(arg)` will return no matches (an empty
list), so we need to check for that possibility before attempting to
access the first element of the list.
After applying the fix in the prior commit, the next error I ran into
was:
File ".../mat_documenters.py", line 997, in make_baseclass_links
obj_bases = obj.__bases__
^^^^^^^^^^^^^
AttributeError: 'MatFunction' object has no attribute '__bases__'.
Did you mean: '__class__'?
It appeared we were trying to add links to base classes for all object
types (functions, in the error above), not just classes.
This was referenced Oct 6, 2025
Collaborator
|
the fact that we are not seeing the crashes you are seeing means that we have blind spots in the test suite: do you think you can add regression tests to show the bug (or bugs) this PR is fixing? |
Contributor
Author
|
My apologies. Due to other priorities, I likely won't have time to come back to this till January, at the earliest. |
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.
While attempting to test the scenarios mentioned in the description of #278, I came across what appear to be some bugs created in commit 4cd5c51. I'm not sure if these fixes are the best way to address them, though; all I know is they got my Sphinx build back up and running again.
Commits
fix: Handle the zero matches case (da08566)
When trying to test out the
masterbranch against my project, to see if we're ready for a 0.23.0 release, I ran into the following error:Digging further, the problem was actually:
I was able to rewind through history to find this problem first arose with commit 4cd5c51. The problem is occasionally
q_arg.matches(arg)will return no matches (an empty list), so we need to check for that possibility before attempting to access the first element of the list.fix: Don't link to base classes for non-classes (0a81e9b)
After applying the fix in the prior commit, the next error I ran into was:
It appeared we were trying to add links to base classes for all object types (functions, in the error above), not just classes.
Notes to Reviewers
My process was:
masterand ensure my Sphinx build was still working.tox -e "3.8-sphinx45"to ensure the tests were still passing.If these fixes should be implemented in a different way, please feel free to push commits to this branch.