Skip to content

gh-79478: Update untokenize.rst documentation to reflect current implementation#150225

Open
ByteFlowing1337 wants to merge 3 commits into
python:mainfrom
ByteFlowing1337:fix-79478
Open

gh-79478: Update untokenize.rst documentation to reflect current implementation#150225
ByteFlowing1337 wants to merge 3 commits into
python:mainfrom
ByteFlowing1337:fix-79478

Conversation

@ByteFlowing1337

@ByteFlowing1337 ByteFlowing1337 commented May 22, 2026

Copy link
Copy Markdown
Contributor

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32807385 | 📁 Comparing 27239f2 against main (1daad8a)

  🔍 Preview build  

1 file changed
± library/tokenize.html

Comment thread Doc/library/tokenize.rst

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the docs could be more explicit about whether the iterator may or may not mix 2- and 5-element sequences.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added a para describing the behavior when they are mixed. :)

Comment thread Doc/library/tokenize.rst Outdated
Comment thread Doc/library/tokenize.rst Outdated
Comment thread Doc/library/tokenize.rst Outdated
Comment thread Doc/library/tokenize.rst
Comment thread Doc/library/tokenize.rst Outdated
@ByteFlowing1337

Copy link
Copy Markdown
Contributor Author

Thank you all for the review!

@ByteFlowing1337

ByteFlowing1337 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

I replaced the word exactly that I introduced in my first commit.

The original docstring of untokenize once said: Round-trip invariant for full input: Untokenized source will match input source exactly, but that was inaccurate (see #128031), and it was updated to match the docs in #128521.

So even with a full input, the spacing between tokens (column positions) may still change, but it's a rare case.


I also replaced must with should , because I found that untokenize() accepts even three- or six-element sequences in iterable, only if the two-element sequence is encountered earlier in the iterable. It's also a rare case.

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

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants