Skip to content

Pin tree-sitter to 0.20.4 for OSS and internal (#117)#117

Closed
mgrange1998 wants to merge 1 commit into
facebookresearch:mainfrom
mgrange1998:export-D98013757
Closed

Pin tree-sitter to 0.20.4 for OSS and internal (#117)#117
mgrange1998 wants to merge 1 commit into
facebookresearch:mainfrom
mgrange1998:export-D98013757

Conversation

@mgrange1998
Copy link
Copy Markdown
Contributor

@mgrange1998 mgrange1998 commented Mar 24, 2026

Summary:

Problem

The tree-sitter 0.25.0 API changed Language.__init__ to require a name parameter, breaking our code that passes only a capsule pointer.

Solution

  • Pin tree-sitter to 0.20.4 in both PACKAGE files and pyproject.toml
  • Add _language_from_capsule() compatibility shim that extracts the raw pointer from the PyCapsule returned by tree-sitter-python/cpp language packages and constructs a Language object compatible with 0.20.4
  • Switch from Parser(language) to Parser() + parser.set_language() (0.20.4 API)

Differential Revision: D98013757

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 24, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 24, 2026

@mgrange1998 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D98013757.

@meta-codesync meta-codesync Bot changed the title Pin tree-sitter to 0.20.4 for OSS and internal Pin tree-sitter to 0.20.4 for OSS and internal (#117) Mar 24, 2026
mgrange1998 added a commit to mgrange1998/PrivacyGuard-1 that referenced this pull request Mar 24, 2026
Summary:

## Problem
The tree-sitter 0.25.0 API changed `Language.__init__` to require a `name` parameter, breaking our code that passes only a capsule pointer.

## Solution
- Pin tree-sitter to 0.20.4 in both PACKAGE files and pyproject.toml
- Add `_language_from_capsule()` compatibility shim that extracts the raw pointer from the PyCapsule returned by tree-sitter-python/cpp language packages and constructs a Language object compatible with 0.20.4
- Switch from `Parser(language)` to `Parser()` + `parser.set_language()` (0.20.4 API)

Differential Revision: D98013757
Summary:

## Problem
The tree-sitter 0.25.0 API changed `Language.__init__` to require a `name` parameter, breaking our code that passes only a capsule pointer.

## Solution
- Pin tree-sitter to 0.20.4 in both PACKAGE files and pyproject.toml
- Add `_language_from_capsule()` compatibility shim that extracts the raw pointer from the PyCapsule returned by tree-sitter-python/cpp language packages and constructs a Language object compatible with 0.20.4
- Switch from `Parser(language)` to `Parser()` + `parser.set_language()` (0.20.4 API)

Differential Revision: D98013757
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 25, 2026

This pull request has been merged in 9ad0fc7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant