Skip to content

gh-155419: honor the file object's current position in hashlib.file_digest - #155422

Merged
picnixz merged 5 commits into
python:mainfrom
picnixz:meta/crypto/py/hashlib/file-digest-honor-position-155419
Dec 3, 2026
Merged

picnixz merged 5 commits into
python:mainfrom
picnixz:meta/crypto/py/hashlib/file-digest-honor-position-155419

Conversation

@picnixz

@picnixz picnixz commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Comment thread Lib/hashlib.py Resolved
@picnixz picnixz removed the needs backport to 3.13 only security fixes label Oct 19, 2026
@picnixz picnixz self-assigned this Oct 19, 2026
@picnixz picnixz added the sprint label Oct 20, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 20, 2026
…sIO` only

Objects exposing `getbuffer()` without being `io.BytesIO` instances
are now read through `readinto()`. The `io` module is imported lazily.
`BytesIOProxy` exposes the `io.BytesIO` interface without being an
instance of it, so `hashlib.file_digest` reads it with `readinto()`
from its current position.

@cmaloney cmaloney left a comment

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.

The hashlib change is good to me. The test_hashlib seems to add a lot of complexity for the extra things it's testing which seems out of proportion with the amount of hashlib code changed. If it's covering more I think the refactor is reasonable

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Oct 25, 2026
@picnixz
picnixz merged commit 5f6de00 into python:main Dec 3, 2026
53 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Dec 3, 2026
@picnixz
picnixz deleted the meta/crypto/py/hashlib/file-digest-honor-position-155419 branch December 3, 2026 12:48
@miss-islington-app

Copy link
Copy Markdown

Sorry, @picnixz, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 5f6de00ebed9cfa811f5974ea8cc4e20b86e253c 3.14

@bedevere-app

bedevere-app Bot commented Dec 3, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Dec 3, 2026
hugovk pushed a commit that referenced this pull request Dec 4, 2026
…b.file_digest` (GH-155422) (#163081)

gh-155419: honor the file object's current position in `hashlib.file_digest` (GH-155422)
(cherry picked from commit 5f6de00)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz

picnixz commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Oh 3.14 backport failed. On it.

@bedevere-app

bedevere-app Bot commented Dec 4, 2026

Copy link
Copy Markdown

GH-163149 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 Dec 4, 2026
picnixz added a commit that referenced this pull request Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants