Repository navigation
fix(py): switch to tree-sitter-python-orchard for PEP 798 support - #194
Merged
Merged
Conversation
The official tree-sitter-python 0.25 grammar fails to parse PEP 798
unpacking in comprehensions (e.g. `{**d for d in ds}`), reporting a
syntax error and potentially miscounting the comprehension's
complexity. Upstream is unmaintained; the fix lives in the community
fork tree-sitter-python-orchard, which is ABI-compatible with
tree-sitter 0.27.
Fixes #193
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Code Complexity (src)
Reported by octocov |
Contributor
Code Metrics Report
Details | | main (af2abb8) | #194 (c4ed35d) | +/- |
|---------------------|----------------|----------------|--------|
+ | Coverage | 95.0% | 95.0% | +0.0% |
| Files | 36 | 36 | 0 |
| Lines | 16835 | 16849 | +14 |
+ | Covered | 16002 | 16016 | +14 |
+ | Test Execution Time | 4m34s | 15s | -4m19s |Code coverage of files in pull request scope (96.9% → 96.9%, patch 100.0%)
Reported by octocov |
Merged
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.
Fixes #193
Summary
The official
tree-sitter-python0.25 grammar does not support PEP 798 (Python 3.15) unpacking in comprehensions, so code like{**d for d in ds}produced a parse error and the comprehension's complexity could be miscounted. Upstream has been inactive since 2025-09; the fix (tree-sitter/tree-sitter-python#353) is merged only in the community fork tree-sitter-python-orchard.Changes
cccc-py: replacetree-sitter-python = "0.25"withtree-sitter-python-orchard = "0.6"(ABI 14 viatree-sitter-language0.1, works with tree-sitter 0.27; no adapter logic changes beyond the import).{**d for …},{**d async for …},[*xs for …],{*xs for …}, and(*xs for …); each parses cleanly and scores like the written-out loop.docs/ADDING_A_LANGUAGE.md, a comment indeep_nesting.rs, and both lockfiles (workspace +cccc-py/fuzz).Verification
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings, andcargo test --workspaceall pass (including existing Python fixtures anddeep_nesting).parse_error_count: 0, cognitive 1, cyclomatic 2.🤖 Generated with Claude Code