GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — gh-153569: return token spans and unify decoded source storage by pablogsal · Pull Request #156482 · python/cpython Conversation
|
|
Do not review until #156472 lands. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
dddc133 to
1753605
Compare
|
#156472 has landed; this is rebased on it now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1753605 to
8bd1d3a
Compare
8bd1d3a to
c10fd82
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
183
Sorry, something went wrong.
There was an error while loading. Please reload this page.
150ee6a to
f134e81
Compare
File and readline tokenizers keep every byte they read because the lexer owns buffer growth and repairs its pointers after reallocations. Long inputs therefore grow tokenizer memory with the entire source. Let the reader reuse a bounded input window when no token or formatted string needs older bytes. Track the absolute offset of that window and save pointer offsets only when backing storage moves.
Tokenizer results expose pointers into the active input buffer. That ties every consumer to the buffer lifetime and prevents the reader from reusing older storage. Return logical source spans with their start and end locations instead. Pegen and `_tokenize` materialize a short-lived view before requesting another token, and the tokenizer no longer keeps a second end pointer for the last token.
bf25f7b to
6117ae3
Compare
There was an error while loading. Please reload this page.
…ython#156482) Represent token boundaries as logical source offsets with explicit start and end locations, and adapt pegen and _tokenize to consume them. Use SourceText to own decoded input across all reader modes. Streaming readers discard consumed windows while preserving logical offsets and reusing the allocation. Prepared and interactive input retain their source. Force source relocation on growth in debug builds and add coverage for formatted-string growth, interactive input, storage reuse, and offset limits. Scanner positions remain pointers, rebased when storage moves.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.