On Sat, Feb 6, 2021 at 3:26 PM Inada Naoki <songofaca...@gmail.com> wrote:
> I changed my mind. Since there is no plan to change the default
> encoding for now,
> no need to encourage `encoding="locale"` soon.
>
> Until users can drop Python 3.9 support, they can use EncodingWarning
> only for finding missing `encoding="utf-8"` or `encoding="ascii"`.
>
> I will remove the io.LOCALE_ENCODING.

I recall that something like 1 year ago, I basically tried to
implement something like your PEP, to see if the stdlib calls open()
without specifying an encoding. There were so many warnings, that the
output was barely readable.

The warning would only be useful if there is a way to modify the code
to make the warning quiet (fix the issue) without losing support with
Python 3.9 and older.

I understand that open(filename) must be replaced with open(filename,
encoding=("locale" if sys.version_info >= (3, 10) else None)) to make
it backward and forward compatibility without emitting an
EncodingWarning. One issue is that some people may blindly copy/paste
this code pattern without thinking if "locale" is the proper encoding.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/6CRWIH6AJ43H2IRQZDJFUSSYUFPDSY3L/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to