Skip to content

gh-153569: return tokenizer tokens as source spans - #156482

Draft
pablogsal wants to merge 2 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-offset-state
Draft

gh-153569: return tokenizer tokens as source spans#156482
pablogsal wants to merge 2 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-offset-state

Conversation

@pablogsal

@pablogsal pablogsal commented Aug 27, 2026

Copy link
Copy Markdown
Member

The tokenizer currently returns pointers into its active input buffer. This switches that result to a logical source span with start/end locations, then updates pegen and _tokenize to consume the span directly.

File and readline input keep a bounded active window and advance an absolute source offset when it is reused. Prepared and interactive input keep their SourceText backing. Buffer relocation is centralized, and the old returned-token pointers, tok_state.end, and reserve-buffer API are gone. This is the next chunk of #153569 after #156472.

@pablogsal

Copy link
Copy Markdown
Member Author

Do not review until #156472 lands.

@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-offset-state branch from dddc133 to 1753605 Compare August 28, 2026 15:32
@pablogsal

Copy link
Copy Markdown
Member Author

#156472 has landed; this is rebased on it now.

@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-offset-state branch from 1753605 to 8bd1d3a Compare August 28, 2026 16:24
@pablogsal pablogsal changed the title gh-153569: move tokenizer state to source offsets gh-153569: drive tokenizer input through source offsets Aug 28, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-offset-state branch from 8bd1d3a to c10fd82 Compare August 28, 2026 18:08
@pablogsal pablogsal changed the title gh-153569: drive tokenizer input through source offsets gh-153569: return tokenizer tokens as source spans Aug 28, 2026

@linakhan470-cell linakhan470-cell left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

183

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants