Skip to content

gh-134837: Correct and improve base85 documentation for base64 and binascii modules#145843

Merged
serhiy-storchaka merged 13 commits into
python:mainfrom
dhdaines:improve_base64_docs
May 12, 2026
Merged

gh-134837: Correct and improve base85 documentation for base64 and binascii modules#145843
serhiy-storchaka merged 13 commits into
python:mainfrom
dhdaines:improve_base64_docs

Conversation

@dhdaines
Copy link
Copy Markdown
Contributor

@dhdaines dhdaines commented Mar 11, 2026

As noted in the issue there are a few clarifications needed in the "Base85 Encodings" section of the base64 module documentation. Namely:

  • Base85 is not a de facto standard, but three actual standards, including one actual April Fool's joke (really!)
  • The behaviour of adobe=True was not fully specified, particularly that it raises ValueError on unterminated input
  • The behaviour of pad=True was not correctly described - the input is always padded, the question is whether this padding is retained in the output encoding.

Also note that pad=True is required by the ZeroMQ standard, but perhaps ZeroMQ is tolerant of Z85 encoded data that isn't a multiple of 5 bytes.


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

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Mar 11, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 8, 2026
@dhdaines
Copy link
Copy Markdown
Contributor Author

dhdaines commented May 8, 2026

Hello! Is there anything that needs to be done to get this PR reviewed?

@sergey-miryanov
Copy link
Copy Markdown
Contributor

сс @serhiy-storchaka Could you please take a look?

Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

In general, LGTM. Thank you @dhdaines for your contribution.

Please look also at binascii.rst. It also contains documentation for Base85 related functions, mostly copied from base64.rst.

And since you updated documentation for some parameters, I think that docstrings for base64 and binascii functions also may need updates. Docstrings should not be as verbose as the main documentation, but they should be consistent with it.

Comment thread Doc/library/base64.rst Outdated
Comment thread Doc/library/base64.rst Outdated
Comment thread Doc/library/base64.rst Outdated
@dhdaines
Copy link
Copy Markdown
Contributor Author

Please look also at binascii.rst. It also contains documentation for Base85 related functions, mostly copied from base64.rst.

Good, yes, I will make sure that they are in agreement.

And since you updated documentation for some parameters, I think that docstrings for base64 and binascii functions also may need updates. Docstrings should not be as verbose as the main documentation, but they should be consistent with it.

Oh! Thanks for the reminder - I will update the relevant docstrings, since the whole reason for this PR is that some functions didn't behave as documented.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 12, 2026

@dhdaines
Copy link
Copy Markdown
Contributor Author

Everything should be good now! I've updated the docstrings for both base64 and binascii, as well as the documentation for binascii.

Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍 I have only one question.

Comment thread Doc/library/base64.rst Outdated
@serhiy-storchaka serhiy-storchaka added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes and removed stale Stale PR or inactive for long period of time. labels May 12, 2026
@serhiy-storchaka serhiy-storchaka merged commit e667d62 into python:main May 12, 2026
65 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs May 12, 2026
@miss-islington-app
Copy link
Copy Markdown

Thanks @dhdaines for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app
Copy link
Copy Markdown

Sorry, @dhdaines and @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e667d62f114b54dcba17bdfad3835b9c91fda348 3.14

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 12, 2026

GH-149742 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 12, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 12, 2026

GH-149743 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 May 12, 2026
@serhiy-storchaka serhiy-storchaka changed the title gh-134837: Correct and improve base85 documentation for base64 module gh-134837: Correct and improve base85 documentation for base64 and binascii modules May 12, 2026
serhiy-storchaka pushed a commit that referenced this pull request May 12, 2026
… and binascii modules (GH-145843) (GH-149742)

(cherry picked from commit e667d62)

Co-authored-by: David Huggins-Daines <dhd@ecolingui.ca>
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.

3 participants