Skip to content

gh-82663: Clarify codecs.iterdecode/encode docs #136497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025

Conversation

StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Jul 10, 2025

I do not think there is a need for an example as @doerwalter suggested, but I do not mind adding one.


📚 Documentation preview 📚: https://cpython-previews--136497.org.readthedocs.build/

Copy link
Member

@malemburg malemburg left a comment

Choose a reason for hiding this comment

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

I'm not sure whether we should do this. The codecs machinery is not tied to str<->bytes only.

While it's true that the current implementation of those two functions will only work with iterators of certain types, this is an (unwanted) side-effect of their use of "" and b"" in the implementation. More correct would be to use input[:0] to finalize the encoder.

Perhaps it's better to write e.g. "For most encodings, iterator must yield :class:str objects."

@malemburg
Copy link
Member

Ok, I had another look at what Walter had implemented for the incremental encoders/decoders and he does indeed assume that only str<->bytes encoding can be used.

@malemburg malemburg merged commit 4b41b20 into python:main Jul 10, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jul 10, 2025
@malemburg
Copy link
Member

Thanks, @StanFromIreland

@malemburg malemburg added 3.13 bugs and security fixes 3.14 bugs and security fixes needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes and removed 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jul 10, 2025
@miss-islington-app
Copy link

Thanks @StanFromIreland for the PR, and @malemburg for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @StanFromIreland for the PR, and @malemburg for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 10, 2025
)

Closes pythonGH-82663
(cherry picked from commit 4b41b20)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 10, 2025
)

Closes pythonGH-82663
(cherry picked from commit 4b41b20)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Jul 10, 2025

GH-136512 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 10, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jul 10, 2025

GH-136513 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 10, 2025
@StanFromIreland StanFromIreland deleted the gh-82663 branch July 10, 2025 15:40
malemburg pushed a commit that referenced this pull request Jul 10, 2025
…136512)

gh-82663: Clarify `codecs.iterdecode/encode` docs (GH-136497)

Closes GH-82663
(cherry picked from commit 4b41b20)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
malemburg pushed a commit that referenced this pull request Jul 10, 2025
…136513)

gh-82663: Clarify `codecs.iterdecode/encode` docs (GH-136497)

Closes GH-82663
(cherry picked from commit 4b41b20)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy