-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-122179: Fix hashlib.file_digest and non-blocking I/O #122183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b7a1e6e
d571850
5669cce
d4b385f
218fd35
612f7d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,7 +272,10 @@ a file or file-like object. | |
| *fileobj* must be a file-like object opened for reading in binary mode. | ||
| It accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` | ||
| instances, SocketIO objects from :meth:`socket.socket.makefile`, and | ||
| similar. The function may bypass Python's I/O and use the file descriptor | ||
| similar. *fileobj* must be opened in blocking mode, otherwise a | ||
| :exc:`BlockingIOError` may be raised. | ||
|
|
||
| The function may bypass Python's I/O and use the file descriptor | ||
| from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be | ||
| in an unknown state after this function returns or raises. It is up to | ||
| the caller to close *fileobj*. | ||
|
|
@@ -301,6 +304,10 @@ a file or file-like object. | |
|
|
||
| .. versionadded:: 3.11 | ||
|
|
||
| .. versionchanged:: next | ||
| Now raises a :exc:`BlockingIOError` if the file is opened in blocking | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this meant to be " As written it contradicts the previous addition 30 lines up and the NEWS.d entry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be "if the file is opened in non-blocking mode." More specifically: (PR to update the docs welcome if you're interested in contributing directly; happy to help review) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do |
||
| mode. Previously, spurious null bytes were added to the digest. | ||
|
|
||
|
|
||
| Key derivation | ||
| -------------- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| :func:`hashlib.file_digest` now raises :exc:`BlockingIOError` when no data | ||
| is available during non-blocking I/O. Before, it added spurious null bytes | ||
| to the digest. |
Uh oh!
There was an error while loading. Please reload this page.