From c196dc6e6668e70fcc31274d826415852f0f787e Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Wed, 23 Mar 2022 17:15:33 +0900 Subject: [PATCH] PEP 686: Change target version to 3.13 (#2457) --- pep-0686.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pep-0686.rst b/pep-0686.rst index b22c9fc28..9b2ab2d04 100644 --- a/pep-0686.rst +++ b/pep-0686.rst @@ -6,7 +6,7 @@ Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 18-Mar-2022 -Python-Version: 3.12 +Python-Version: 3.13 Post-History: `18-Mar-2022 `__ @@ -55,14 +55,18 @@ User can still disable UTF-8 mode by setting ``PYTHONUTF8=0`` or ``-X utf8=0``. ``locale.get_encoding()`` ------------------------- -Add ``locale.get_encoding()``. It is same to -``locale.getpreferredencoding(False)`` except it don't follow UTF-8 mode. +Currently, ``TextIOWrapper`` uses ``locale.getpreferredencoding(False)`` +when ``encoding="locale"`` option is specified. It is ``"UTF-8"`` in UTF-8 mode. -This API will be used by ``io.TextIOWrapper`` to support ``encoding="locale"`` -option. +This behavior is inconsistent with the :pep:`597` motivation. +``TextIOWrapper`` should use locale encoding when ``encoding="locale"`` is +passed before/after the default encoding is changed to UTF-8. -This change will be released in Python 3.11 so that users can prepare before -UTF-8 mode is enabled by default. +To fix this inconsistency, we will add ``locale.get_encoding()``. It is same +to ``locale.getpreferredencoding(False)`` but it ignore the UTF-8 mode. + +This change will be released in Python 3.11 so that users can use UTF-8 mode +that is same to Python 3.13. Backward Compatibility