Skip to content

[WIP] bpo-37214: Add a new EncodingWarning warning category #13938

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

Closed
wants to merge 1 commit into from
Closed

[WIP] bpo-37214: Add a new EncodingWarning warning category #13938

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 10, 2019

open() now emits a EncodingWarning if called with encoding=None.

https://bugs.python.org/issue37214

open() now emits an EncodingWarning if called with encoding=None.
@vstinner
Copy link
Member Author

@methane: What do you think of this approach? Does it make any sense to have an opt-in warning?

@methane
Copy link
Member

methane commented Jun 13, 2019

@methane: What do you think of this approach? Does it make any sense to have an opt-in warning?

No. Warning everytime when encoding is omitted was @zooba 's suggestion. But he opposite to change default encoding strongly.
Without planned breaking change, adding warning which everyone ignore doesn't make sense to me.

In PEP 597 (2nd), I am proposing adding more option. macOS user can test their code easily with PYTHONTEXTENCODING=ascii. They can notice if their code is depending on default encoding is UTF-8.

Anyway, I'm thinking about advertising your UTF-8 mode.
Windows user can run code which assumes default text encoding is UTF-8.

@vstinner
Copy link
Member Author

Ok. I may keep this PR open to show that always emit a warning can be a bad idea :-)

@vstinner
Copy link
Member Author

vstinner commented Jun 14, 2019

I wrote this PR to discuss https://www.python.org/dev/peps/pep-0597/ but it's unrelated to the implementation of this PEP :-)

@vstinner
Copy link
Member Author

I abandon this PR.

@vstinner vstinner closed this Jun 18, 2019
@vstinner vstinner deleted the encoding_warning branch June 18, 2019 10:13
methane added a commit to methane/cpython that referenced this pull request Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants