summaryrefslogtreecommitdiffstats
path: root/Programs
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-29 09:47:29 (GMT)
committerGitHub <noreply@github.com>2018-08-29 09:47:29 (GMT)
commitdfe0dc74536dfb6f331131d9b2b49557675bb6b7 (patch)
tree485dd3b5ddce8e6c2d7ebbd6d113e1c5ee6f3707 /Programs
parent177d921c8c03d30daa32994362023f777624b10d (diff)
downloadcpython-dfe0dc74536dfb6f331131d9b2b49557675bb6b7.zip
cpython-dfe0dc74536dfb6f331131d9b2b49557675bb6b7.tar.gz
cpython-dfe0dc74536dfb6f331131d9b2b49557675bb6b7.tar.bz2
bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)
* Add stdio_encoding and stdio_errors fields to _PyCoreConfig. * Add unit tests on stdio_encoding and stdio_errors.
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_testembed.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index d0c00cf..d569417 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -374,6 +374,8 @@ dump_config(void)
printf("user_site_directory = %i\n", config->user_site_directory);
printf("buffered_stdio = %i\n", config->buffered_stdio);
ASSERT_EQUAL(config->buffered_stdio, !Py_UnbufferedStdioFlag);
+ printf("stdio_encoding = %s\n", config->stdio_encoding);
+ printf("stdio_errors = %s\n", config->stdio_errors);
/* FIXME: test legacy_windows_fs_encoding */
/* FIXME: test legacy_windows_stdio */
@@ -532,6 +534,11 @@ static int test_init_from_config(void)
Py_UnbufferedStdioFlag = 0;
config.buffered_stdio = 0;
+ putenv("PYTHONIOENCODING=cp424");
+ Py_SetStandardStreamEncoding("ascii", "ignore");
+ config.stdio_encoding = "iso8859-1";
+ config.stdio_errors = "replace";
+
putenv("PYTHONNOUSERSITE=");
Py_NoUserSiteDirectory = 0;
config.user_site_directory = 0;
@@ -569,6 +576,7 @@ static void test_init_env_putenvs(void)
putenv("PYTHONNOUSERSITE=1");
putenv("PYTHONFAULTHANDLER=1");
putenv("PYTHONDEVMODE=1");
+ putenv("PYTHONIOENCODING=iso8859-1:replace");
/* FIXME: test PYTHONWARNINGS */
/* FIXME: test PYTHONEXECUTABLE */
/* FIXME: test PYTHONHOME */