Skip to content

Commit ff8fa96

Browse files
committed
fix(ci): pin tree-sitter<0.26 to stop native segfault (#235)
1 parent 1d99322 commit ff8fa96

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/workflows/codelens-benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
with:
1616
python-version: '3.12'
1717
- name: Install dependencies
18-
run: pip install pyyaml tree-sitter pytest
18+
run: pip install pyyaml "tree-sitter>=0.21.0,<0.26" pytest
1919
- name: Run full benchmarks
2020
run: python3 benchmarks/run_benchmarks.py
2121
- name: Check regression

.github/workflows/codelens-ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ jobs:
3333
- name: Install dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install tree-sitter pyyaml pytest pytest-cov pygls lsprotocol
36+
# tree-sitter pinned <0.26: core 0.26.0 changed Node lifetime handling
37+
# and causes a native use-after-free SIGSEGV in tree_sitter_python._binding
38+
# even on shallow files (issue #235). python_parser.py's keep_alive
39+
# mitigation is insufficient for 0.26; 0.25.x is known-safe.
40+
pip install "tree-sitter>=0.21.0,<0.26" pyyaml pytest pytest-cov pygls lsprotocol
3741
# Install optional grammar packages for full parser coverage
3842
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
3943
pip install tree-sitter-typescript tree-sitter-rust || true
4044
4145
- name: Run test suite
4246
run: |
43-
# ulimit -s unlimited prevents SIGSEGV from tree-sitter's internal C
44-
# recursion on deeply-nested ASTs (issue #235, test_large_file_parsing.py)
45-
ulimit -s unlimited
4647
cd scripts && python -m pytest ../tests/ -v --tb=short \
4748
--ignore=../tests/test_integration.py
4849
@@ -68,7 +69,7 @@ jobs:
6869
- name: Install dependencies
6970
run: |
7071
python -m pip install --upgrade pip
71-
pip install tree-sitter pyyaml
72+
pip install "tree-sitter>=0.21.0,<0.26" pyyaml
7273
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
7374
pip install tree-sitter-typescript tree-sitter-rust || true
7475
@@ -98,7 +99,7 @@ jobs:
9899
- name: Install dependencies
99100
run: |
100101
python -m pip install --upgrade pip
101-
pip install tree-sitter pyyaml
102+
pip install "tree-sitter>=0.21.0,<0.26" pyyaml
102103
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
103104
pip install tree-sitter-typescript tree-sitter-rust || true
104105

.github/workflows/codelens-sarif.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install tree-sitter pyyaml
36+
pip install "tree-sitter>=0.21.0,<0.26" pyyaml
3737
pip install tree-sitter-python tree-sitter-javascript tree-sitter-html tree-sitter-css || true
3838
pip install tree-sitter-typescript tree-sitter-rust || true
3939

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ classifiers = [
3939
]
4040

4141
dependencies = [
42-
"tree-sitter>=0.21.0",
42+
# Upper-bound <0.26: tree-sitter core 0.26.0 changed Node lifetime handling,
43+
# causing a native use-after-free SIGSEGV in the grammar bindings even on
44+
# shallow files (issue #235). Remove the cap once python_parser.py's
45+
# keep_alive strategy is made 0.26-safe.
46+
"tree-sitter>=0.21.0,<0.26",
4347
]
4448

4549
[project.optional-dependencies]

0 commit comments

Comments
 (0)