Thank you, Victor.

I had considered dropping (a) from the PEP. But I keep them because:

* I rushed to write PEP, before 3.11 beta.
* In the "Backward compatibility" section in the PEP, I want to
mention `locale.getencoding()` and `encoding="locale"`
* But they are not fixed in the main branch yet. So I need to include
what needs to be fixed in 3.11 in the PEP.

But for now, we are close to merge `locale.getencoding()`.
And I am afraid merging it before the PEP accepted even though it is
documented in the PEP...

Now I think the best way is:

* Withdraw the PEP submission temporarily.
* Implement `locale.getencoding()` and fix `encoding="locale"` in the
main branch.
* Remove them from the PEP.
* Resubmit the PEP.

And if the PEP is accepted, I want to do this in the 3.11 branch (even
though it will be beta already):

* Improve document about UTF-8 mode and EncodingWarning based on the PEP.
* Add (opt-in) EncodingWarning to `locale.getpreferredencoding()` and
`subprocess.Popen(text=True)`.

On Thu, Apr 7, 2022 at 9:42 PM Victor Stinner <vstin...@python.org> wrote:
>
> IMO adding locale.getencoding() to Python 3.11 is not controversial
> and is useful even if PEP 686 is rejected. This function was discussed
> for 1 year (bpo-43510, bpo-43552, bpo-43557, bpo-47000) and there is
> an agreement that there is a need for this function.
>
> > Making `open(path, encoding="locale")` use locale encoding in UTF-8 mode 
> > (Python 3.10 used UTF-8)
>
> If someone explicitly opts in for the "locale encoding", it sounds
> surprising that the locale (encoding) is ignored and that UTF-8 is
> used if the Python UTF-8 Mode is enabled. I'm fine with this change.
> If you want to always UTF-8... Pass explicitly UTF-8:
>
>     # no surprise, always decode file content from UTF-8
>     json_file = open(filename, encoding="utf-8")
>
> --
>
> I will not comment PEP 686 here. It's being discussed on Discourse:
>
> * https://discuss.python.org/t/14435
> * https://discuss.python.org/t/14737
>
> Victor
>
> On Thu, Apr 7, 2022 at 5:35 AM Inada Naoki <songofaca...@gmail.com> wrote:
> >
> > Hi, Pablo.
> >
> > I just submitted the PEP 686 to the SC.
> > https://github.com/python/steering-council/issues/118
> >
> > In this PEP, I am proposing:
> >
> > a. Small improvement for UTF-8 mode in Python 3.11
> > b. Make UTF-8 mode default in Python 3.13.
> >
> > (a) is an important change for (b) so I included it in the PEP.
> > More precisely, (a) contains two changes:
> >
> > * Making `open(path, encoding="locale")` use locale encoding in UTF-8
> > mode (Python 3.10 used UTF-8)
> > * Add `locale.getencoding()` that is same to
> > `locale.getpreferredencoding(False)` but returns locale encoding even
> > in UTF-8 mode.
> >
> > These changes are important for (b).
> > But they are not a big change needing PEP.
> >
> > What should I do?
> >
> > * Do not merge anything until PEP accepted.
> > * Merge (a) without waiting PEP accepted.
> > * Merge (a) and remove it from the PEP.
> >
> > FWI, I and Victor are implementing `locale.getencoding()` for now.
> >
> > https://bugs.python.org/issue47000
> > https://github.com/python/cpython/pull/32068
> >
> > Regards,
> > --
> > Inada Naoki  <songofaca...@gmail.com>
> > _______________________________________________
> > python-committers mailing list -- python-committ...@python.org
> > To unsubscribe send an email to python-committers-le...@python.org
> > https://mail.python.org/mailman3/lists/python-committers.python.org/
> > Message archived at 
> > https://mail.python.org/archives/list/python-committ...@python.org/message/7E4QEKZ6HNDDPDL76LP3TBBKLAUQ7AHB/
> > Code of Conduct: https://www.python.org/psf/codeofconduct/
>
>
>
> --
> Night gathers, and now my watch begins. It shall not end until my death.



-- 
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
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/XVJEAF7S2OORL77QMLLQTWKHLRDFA3KH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to