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 PEP 597 UTF-8 Warnings #8117
Conversation
Should we also try setting Also, does
|
Hi @rokm, thanks so much for the feedback. I made the following changes:
As you said, UTF-8 should be good on macOS and Linux because it is already the default Python locale on those platforms. On Windows, if we specify the encoding and use it consistently, we should hopefully help avoid errors like the one you mentioned above. This should help get ahead of the game when UTF-8 becomes the default on all platforms. |
Ufff, that did open a whole can of warnings :) I would prefer to turn them into errors, but it looks like that Still, we can track them in the tests' summary output, and that's good enough. I see majority are from the test suite, but there are some remaining problems in the "main" code. At least this one should be taken care of immediately, because it poisons the expected stderr output of the test and causes it to fail. Do you want to take care of the rest, or would you prefer I take over and mop them up later? |
The problem is that UTF-8 will become default on all platforms in python, but the external programs that we need to run via |
Hi @rokm, I'll try to cleanup the remaining warnings today. Thanks! |
3b08877
to
ffe8459
Compare
9688c57
to
8b6bc3a
Compare
PEP 685 makes UTF-8 the default mode for Python. Explicitly add encoding parameters to open calls. - Replace subprocess check_output with the more modern run command and set the default encoding of UTF-8 - compat: remove exec_command_stdout function since no longer needed to maintain compatibility across platforms
@danyeaw Is the PR ready for final review and merge? |
Hi @rokm, yup, all set! |
Cool, thanks! |
Thanks!! |
There's still two references to |
@Avasam, thanks for noticing this, I can submit a PR to clean it up 👍 |
This PR fixes PEP 597 EncodingWarnings when
PYTHONWARNDEFAULTENCODING
is set to true.It also helps simplify the
exec_command_stdout
compat function by making the default encoding UTF-8 which will be the default in the future with PEP 686.