diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-28 21:26:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 21:26:33 (GMT) |
commit | 9e4994d410970fb4e75168401d159ba47a8f7108 (patch) | |
tree | 31eb67e89ade21902bfe925d353f650ae95fb5d8 /Misc | |
parent | d500e5307aec9c5d535f66d567fadb9c587a9a36 (diff) | |
download | cpython-9e4994d410970fb4e75168401d159ba47a8f7108.zip cpython-9e4994d410970fb4e75168401d159ba47a8f7108.tar.gz cpython-9e4994d410970fb4e75168401d159ba47a8f7108.tar.bz2 |
bpo-34485: Enhance init_sys_streams() (GH-8978)
Python now gets the locale encoding with C code to initialize the encoding
of standard streams like sys.stdout. Moreover, the encoding is now
initialized to the Python codec name to get a normalized encoding name and
to ensure that the codec is loaded. The change avoids importing
_bootlocale and _locale modules at startup by default.
When the PYTHONIOENCODING environment variable only contains an encoding,
the error handler is now is now set explicitly to "strict".
Rename also get_default_standard_stream_error_handler() to
get_stdio_errors().
Reduce the buffer to format the "cpXXX" string (Windows locale encoding).
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2018-08-28-17-48-40.bpo-34485.aFwck2.rst | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2018-08-28-23-01-14.bpo-34485.dq1Kqk.rst | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-08-28-17-48-40.bpo-34485.aFwck2.rst b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-17-48-40.bpo-34485.aFwck2.rst new file mode 100644 index 0000000..f6cd951 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-17-48-40.bpo-34485.aFwck2.rst @@ -0,0 +1,5 @@ +Python now gets the locale encoding with C code to initialize the encoding +of standard streams like sys.stdout. Moreover, the encoding is now +initialized to the Python codec name to get a normalized encoding name and +to ensure that the codec is loaded. The change avoids importing _bootlocale +and _locale modules at startup by default. diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-08-28-23-01-14.bpo-34485.dq1Kqk.rst b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-23-01-14.bpo-34485.dq1Kqk.rst new file mode 100644 index 0000000..5ca373a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-23-01-14.bpo-34485.dq1Kqk.rst @@ -0,0 +1,3 @@ +Fix the error handler of standard streams like sys.stdout: +PYTHONIOENCODING=":" is now ignored instead of setting the error handler to +"strict". |