mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.13] gh-122179: Fix hashlib.file_digest and non-blocking I/O (GH-132787)
gh-122179: Fix hashlib.file_digest and non-blocking I/O (GH-122183)
* Fix hashlib.file_digest and non-blocking I/O
* Add documentation around this behavior
* Add versionchanged
(cherry picked from commit 2b47f46d7d
)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
parent
bb59fdec71
commit
cdabbc126f
4 changed files with 22 additions and 1 deletions
|
@ -231,6 +231,8 @@ def file_digest(fileobj, digest, /, *, _bufsize=2**18):
|
|||
view = memoryview(buf)
|
||||
while True:
|
||||
size = fileobj.readinto(buf)
|
||||
if size is None:
|
||||
raise BlockingIOError("I/O operation would block.")
|
||||
if size == 0:
|
||||
break # EOF
|
||||
digestobj.update(view[:size])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue