Skip to content
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

Fix encoding warnings with PEP 597 enabled #398

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

danyeaw
Copy link
Contributor

@danyeaw danyeaw commented Jan 21, 2024

This PR fixes Encoding Warnings with PEP 597 warnings enabled and enables the warnings in CI. It goes along with python-poetry/poetry#8893 and python-poetry/poetry-core#685.

@bswck
Copy link
Member

bswck commented Jan 21, 2024

The contrib is overall a good idea.
I would only say that having to specify the encoding parameter when "opening" /dev/null seems a bit... nonsensical, i.e. it doesn't reflect the motivation behind PEP 597.

@bswck bswck requested a review from Secrus January 21, 2024 22:35
@danyeaw
Copy link
Contributor Author

danyeaw commented Jan 23, 2024

@bswck I think the idea is that for every open statement we explicitly declare whether the encoding is "utf-8" or "locale", but I agree that /dev/null probably doesn't need an encoding. Do you think it is an issue that we are explicit even with this one?

@Secrus Secrus merged commit d091b7c into python-poetry:main Feb 8, 2024
17 checks passed
@danyeaw danyeaw deleted the fix-encoding-warnings branch February 8, 2024 23:12
@danyeaw
Copy link
Contributor Author

danyeaw commented Feb 8, 2024

Thanks @Secrus!

@radoering
Copy link
Member

I noticed that there is still one open warning:

home/runner/work/cleo/cleo/src/cleo/io/outputs/stream_output.py:53: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.

I'm not sure if we even want UTF-8 Mode to affect it. In any case, I think we should decide between:

  • Suppress this warning because locale.getpreferredencoding() is what we want.
  • Use getencoding() for Python 3.11 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants