Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/hashlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ a file or file-like object.
Example:

>>> import io, hashlib, hmac
>>> with open(hashlib.__file__, "rb") as f:
>>> with open("path/to/file", "rb") as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous code worked because it passes doctest. It probably runs from the repo root, what happens if you use "Doc/library/hashlib.rst" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, now its even cleverer in that this was hand-picked because we know its gonna pass doctest? 🤦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>>> with open("path/to/file", "rb") as f:
>>> with open("Doc/library/hashlib.rst", "rb") as f:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    FileNotFoundError: [Errno 2] No such file or directory: 'Doc/library/hashlib.rst'

https://github.com/python/cpython/actions/runs/15196498586/job/42741793385?pr=134540#step:8:405

... digest = hashlib.file_digest(f, "sha256")
...
>>> digest.hexdigest() # doctest: +ELLIPSIS
Expand Down
Loading