-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
PEP 658/714 metadata files incorrectly probe encoding #9048
Comments
ie the suggestion is @@ -165,7 +165,7 @@ class HTTPRepository(CachedRepository):
)
):
metadata_hash = getattr(hashlib, hash_name)(
- response.text.encode()
+ response.content
).hexdigest()
if metadata_hash != link.metadata_hashes[hash_name]:
self._log( ? sounds plausible |
I fixed almost the same bug last week in pypi-simple: jwodder/pypi-simple#22 Yes that's the fix; I spent 10x on trying to figure out how to test. |
I am not so sure that what you are doing in #9049 is a good test. As you say, the spec insists that the metadata is utf-8, so making some metadata be not utf-8 is taking us further from reality. Myself, I would have been tempted just to submit the fix and see if I could get away with that... |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
https://packaging.python.org/en/latest/specifications/core-metadata/ says that metadata is always utf-8. When computing the metadata hash, poetry can use chardet with utf-8 disabled (I don't know why) which considers it as some 8-bit encoding.
poetry/src/poetry/repositories/http_repository.py
Lines 167 to 169 in f66f8ab
This should just hash the bytes directly.
Workarounds
It falls back to loading wheels instead of .metadata, so this is just annoying in logs and a slight performance hit.
Poetry Installation Method
pipx
Operating System
OS X
Poetry Version
Poetry (version 1.8.1)
Poetry Configuration
Python Sysconfig
Example pyproject.toml
No response
Poetry Runtime Logs
The text was updated successfully, but these errors were encountered: