Repository navigation
Conversation
Preserve the text API while checksumming encoded bytes rather than Unicode code points. Document UTF-8 encoding and strict encoding errors without changing doctests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change
Fixes #15635.
Compute Adler-32 over UTF-8 bytes rather than Unicode code points. Preserve the existing string API, ASCII checksums, and strict encoding errors. Update the function docstring to explain this behavior.
Only one algorithm file is changed. Existing doctests remain unchanged; additional regression doctests are deferred to a separate test-only contribution.
This PR targets this fork only, not upstream.
Validation
Package downloads used the Microsoft Python feed through session-only environment variables; repository configuration was not changed.
python -m doctest -v .\hashes\adler32.pyuvx pytest .\hashes\adler32.py --doctest-modulesuvx --python 3.15t pytest .\hashes\adler32.py --doctest-modulesuvx ruff check .\hashes\adler32.pyuvx ruff format --check .\hashes\adler32.pyuvx ty check .\hashes\adler32.pyuvx pre-commit run --all-filesuv-lock, blocked by a feed-side 404 forfonttoolsmetadatazlib.adler32(text.encode("utf-8")); 3 invalid-surrogate cases correctly raisedUnicodeEncodeErrorReference comparisons covered empty text, ASCII, accented Latin, Japanese, emoji, embedded NULs, combining characters, long inputs, and deterministic random Unicode. The full repository pytest suite was not run.
Checklist