Skip to content

gh-153569: hide tokenizer state behind token and source operations - #156654

Merged
pablogsal merged 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-source-ftstring-clean
Sep 12, 2026
Merged

pablogsal merged 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-source-ftstring-clean

Conversation

@pablogsal

@pablogsal pablogsal commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Make pegen and _tokenize consume tokenizer operations instead of accessing the tokenizer layout. Return token kind, span, location, and raw-string context together, so parser actions use the context of the cached token.

Represent persistent scanner positions as offsets and remove pointer save/restore bookkeeping when input storage grows.

Part of gh-153569.

Previous: #156484. Next: #157055.

@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from b2bc8d1 to d9b2b16 Compare August 30, 2026 13:16
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from 9ce1fd9 to afd9d72 Compare September 5, 2026 17:46
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch from afd9d72 to f72cb2b Compare September 5, 2026 19:17
@pablogsal pablogsal changed the title gh-153569: simplify tokenizer source and formatted-string state Sep 5, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 3 times, most recently from 7e5d82c to 9240806 Compare September 6, 2026 20:57
@pablogsal pablogsal changed the title gh-153569: finish tokenizer offsets, diagnostics, and opaque API Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from 0eb2ce0 to 6f220e4 Compare September 6, 2026 23:35
@pablogsal pablogsal closed this Sep 6, 2026
@pablogsal pablogsal reopened this Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch from 6f220e4 to bbc061f Compare September 7, 2026 00:03
@pablogsal pablogsal changed the title gh-153569: finish tokenizer offsets and the opaque API cutover Sep 7, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch from bbc061f to b619385 Compare September 7, 2026 00:05
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 2 times, most recently from 0b47836 to aef6c9e Compare September 8, 2026 23:27
@pablogsal
pablogsal marked this pull request as ready for review September 8, 2026 23:28
@pablogsal
pablogsal merged commit 7bfa97f into python:main Sep 12, 2026
62 checks passed
@pablogsal
pablogsal deleted the gh-153569-tokenizer-source-ftstring-clean branch September 12, 2026 13:30
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
…ons (python#156654)

Make pegen and _tokenize consume tokenizer operations instead of accessing the tokenizer layout. Return token kind, span, location, and raw-string context together, so parser actions use the context of the cached token.

Represent persistent scanner positions as offsets and remove pointer save/restore bookkeeping when input storage grows.
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
…ons (python#156654)

Make pegen and _tokenize consume tokenizer operations instead of accessing the tokenizer layout. Return token kind, span, location, and raw-string context together, so parser actions use the context of the cached token.

Represent persistent scanner positions as offsets and remove pointer save/restore bookkeeping when input storage grows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant