GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP] bpo-37214: Add a new EncodingWarning warning category by vstinner · Pull Request #13938 · python/cpython

Conversation

@vstinner

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

https://bugs.python.org/issue37214

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BoboTiG and methane reacted with heart emoji
All reactions
  • ❤️ 2 reactions
@vstinner vstinner added the DO-NOT-MERGE label Jun 10, 2019
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jun 10, 2019
@bedevere-bot bedevere-bot added the awaiting core review label Jun 10, 2019
@vstinner
bpo-37214: Add a new EncodingWarning warning category
0dd5d52
open() now emits an EncodingWarning if called with encoding=None.
@vstinner

vstinner commented Jun 13, 2019

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane

methane commented Jun 13, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 14, 2019

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 :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 14, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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 :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 18, 2019

Copy link
Copy Markdown
Member Author

I abandon this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@methane
Add EncodingWarning.
4016278
Copied from python#13938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review DO-NOT-MERGE

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@vstinner @methane @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.