← 返回首页
[WIP] bpo-37214: Add a new EncodingWarning warning category by vstinner · Pull Request #13938 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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

Closed
vstinner wants to merge 1 commit into
python:masterfrom
vstinner:encoding_warning
Closed

[WIP] bpo-37214: Add a new EncodingWarning warning category#13938
vstinner wants to merge 1 commit into
python:masterfrom
vstinner:encoding_warning

Conversation

vstinner commented Jun 10, 2019
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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

methane commented Jun 13, 2019
edited
Loading

Copy link
Copy Markdown
Member

@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.

Copy link
Copy Markdown
Member Author

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

vstinner commented Jun 14, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Member Author

I abandon this PR.

vstinner closed this Jun 18, 2019
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.