Skip to content

fix: parse unpacked string literals in subscripts - #364

Open
Boulea7 wants to merge 1 commit into
tree-sitter:masterfrom
Boulea7:fix/subscript-unpacking
Open

Boulea7 wants to merge 1 commit into
tree-sitter:masterfrom
Boulea7:fix/subscript-unpacking

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 2, 2026

Copy link
Copy Markdown

table[*'ab'] currently produces an ERROR node, and for table[*'id'] in rows: pass loses its for_statement. CPython unpacks the string into the tuple used as the subscript key.

Parse a starred string or implicitly concatenated string as a list_splat in the subscript field. The corpus covers lookup, a mixed slice, a loop target, and syntax errors for double stars and a bare assignment expression. The parser was regenerated with the repository’s pinned tree-sitter CLI 0.25.9.

All 120 corpus cases and the highlight and tag tests pass. I checked dictionary reads, writes, deletion and loop assignment with CPython 3.12 and 3.14, and incremental edits with the reported Python runtime binding, tree-sitter 0.25.2.

Refs #355 for the string-literal cases.

OpenAI Codex generated the patch and ran the local checks.

@wetneb

wetneb commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

I reviewed this PR and didn't find it worthwhile to integrate it in our tree-sitter-python-orchard fork as the fix is too narrowly tailored to the motivating example.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants