summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_utf8_mode.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-28 21:26:33 (GMT)
committerGitHub <noreply@github.com>2018-08-28 21:26:33 (GMT)
commit9e4994d410970fb4e75168401d159ba47a8f7108 (patch)
tree31eb67e89ade21902bfe925d353f650ae95fb5d8 /Lib/test/test_utf8_mode.py
parentd500e5307aec9c5d535f66d567fadb9c587a9a36 (diff)
downloadcpython-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 'Lib/test/test_utf8_mode.py')
-rw-r--r--Lib/test/test_utf8_mode.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py
index df988c1..7280ce7 100644
--- a/Lib/test/test_utf8_mode.py
+++ b/Lib/test/test_utf8_mode.py
@@ -139,16 +139,16 @@ class UTF8ModeTests(unittest.TestCase):
out = self.get_output('-X', 'utf8', '-c', code,
PYTHONIOENCODING="latin1")
self.assertEqual(out.splitlines(),
- ['stdin: latin1/strict',
- 'stdout: latin1/strict',
- 'stderr: latin1/backslashreplace'])
+ ['stdin: iso8859-1/strict',
+ 'stdout: iso8859-1/strict',
+ 'stderr: iso8859-1/backslashreplace'])
out = self.get_output('-X', 'utf8', '-c', code,
PYTHONIOENCODING=":namereplace")
self.assertEqual(out.splitlines(),
- ['stdin: UTF-8/namereplace',
- 'stdout: UTF-8/namereplace',
- 'stderr: UTF-8/backslashreplace'])
+ ['stdin: utf-8/namereplace',
+ 'stdout: utf-8/namereplace',
+ 'stderr: utf-8/backslashreplace'])
def test_io(self):
code = textwrap.dedent('''