Skip to content

gh-153569: centralize formatted-string state and source spans - #156484

Draft
pablogsal wants to merge 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-validation-tools-clean
Draft

gh-153569: centralize formatted-string state and source spans#156484
pablogsal wants to merge 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-validation-tools-clean

Conversation

@pablogsal

@pablogsal pablogsal commented Aug 27, 2026

Copy link
Copy Markdown
Member

Store formatted-string expressions and comments as source spans. Keep active f/t-string frames with explicit transitions between text, expressions, and format specifications, and derive token locations and failure status from scanner state.

Part of gh-153569.

First PR in the stack for gh-153569. Next: #156654.

Comment thread Modules/_xxtestfuzz/fuzzer.c Outdated
@pablogsal pablogsal reopened this Aug 27, 2026
@pablogsal

Copy link
Copy Markdown
Member Author

Do not review until #156482 lands.

@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 5505010 to 68400fb Compare August 28, 2026 18:40
@pablogsal pablogsal changed the title gh-153569: add tokenizer validation tools gh-153569: move f-string state to source spans Aug 28, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch 3 times, most recently from 962c0c5 to eae3e33 Compare August 28, 2026 23:48
@pablogsal pablogsal changed the title gh-153569: move f-string state to source spans gh-153569: simplify tokenizer state Aug 29, 2026
@pablogsal pablogsal changed the title gh-153569: simplify tokenizer state gh-153569: simplify tokenizer state and source storage Aug 29, 2026
@pablogsal pablogsal changed the title gh-153569: simplify tokenizer state and source storage gh-153569: simplify tokenizer and formatted-string state Aug 30, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 73741c4 to 3ce81ac Compare August 30, 2026 11:12
@pablogsal pablogsal changed the title gh-153569: simplify tokenizer and formatted-string state gh-153569: store tokenizer state as source spans Aug 30, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch 2 times, most recently from 6e223e0 to 64893b4 Compare August 30, 2026 11:26
@pablogsal pablogsal changed the title gh-153569: store tokenizer state as source spans gh-153569: remove unused tokenizer cursor support Aug 30, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 64893b4 to bdeeeb6 Compare August 30, 2026 13:16
@pablogsal pablogsal changed the title gh-153569: remove unused tokenizer cursor support gh-153569: remove the unused tokenizer cursor and line index Aug 30, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch 3 times, most recently from 9318772 to 056e86e Compare September 5, 2026 17:46
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch 3 times, most recently from da9dfb7 to 1a1a3c7 Compare September 6, 2026 20:24
@pablogsal
pablogsal marked this pull request as ready for review September 6, 2026 20:31
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 1a1a3c7 to 3ef307f Compare September 6, 2026 20:57
@pablogsal pablogsal changed the title gh-153569: remove the unused tokenizer cursor and line index gh-153569: consolidate tokenizer state around source spans Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 3ef307f to 177eca5 Compare September 6, 2026 21:37
@pablogsal pablogsal changed the title gh-153569: consolidate tokenizer state around source spans gh-153569: consolidate tokenizer source and lexer state Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 0c5a521 to 0b9a33b Compare September 6, 2026 23:35
@pablogsal
pablogsal marked this pull request as draft September 6, 2026 23:37
@pablogsal pablogsal changed the title gh-153569: consolidate tokenizer source and lexer state gh-153569: use source spans and derived tokenizer locations Sep 6, 2026
Formatted-string expressions and comments can outlive the buffer window where
scanning began. Pointer boundaries require buffer relocation to repair tokenizer
state.

Record logical source ranges instead. Retain the active input window while a
formatted string is open, give each mode ownership of its comment spans, and
materialize text through shared span views.
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-validation-tools-clean branch from 0b9a33b to c0ee295 Compare September 7, 2026 00:03
@pablogsal pablogsal changed the title gh-153569: use source spans and derived tokenizer locations gh-153569: centralize formatted-string state and source spans Sep 7, 2026
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