`hashlib.file_digest` does not honor current position for `io.BytesIO` inputs
Aberta
@picnixz já está trabalhando nisso.
Desde 9/8/2026.
stdlib
type-bug
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Bug report
Bug description:
hashlib.file_digest() takes a getbuffer() fast path that hashes the entire buffer regardless of tell(), so the same bytes at the same position give a different digest for io.BytesIO than for a real binary file.
We never had tests to exercise that behavior and we never got report about it. I want to sync the merges of all PRs at once so that the behavior is fixed simultaneously before the next release.
cc @gpshead @hugovk
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-155422
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Avaliação
Esta issue ainda não foi avaliada.