fix: handle tree-sitter parse() str/bytes contract on Python 3.14#5179
Open
Mramaran wants to merge 1 commit into
Open
fix: handle tree-sitter parse() str/bytes contract on Python 3.14#5179Mramaran wants to merge 1 commit into
Mramaran wants to merge 1 commit into
Conversation
On Python 3.14, tree-sitter's Parser.parse() rejects bytes and requires str, while the version pinned by aider (tree-sitter==0.25.2) accepts only bytes. Wrap the parse() call in try/except so both contracts work without changing the pinned dependency. Closes Aider-AI#5174 Closes Aider-AI#5164
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
On Python 3.14, tree-sitter's
Parser.parse()rejectsbytesarguments withTypeError: argument 'source': 'bytes' object is not an instance of 'str',while the version aider pins (
tree-sitter==0.25.2) accepts onlybytes.This wraps both
parser.parse(bytes(code, "utf-8"))call sites with atry/except TypeErrorthat falls back to passing the raw string, so aiderworks on both contracts without changing the pinned dependency.
Files changed
aider/repomap.py(line 299)aider/linter.py(line 220)Test plan
pytest tests/basic/test_repomap.py tests/basic/test_linter.py— 52/52 pass on Python 3.13.5pytest— 446 passed (1 unrelated Windows symlink-permission failure on local env, not present in CI)Closes #5174
Closes #5164