From 3a3983f4899304ed759f515e12152af6f5a0e1e9 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 16 Aug 2023 13:25:01 +0200 Subject: [PATCH] Add #ifdef MS_WINDOWS --- Doc/whatsnew/3.13.rst | 3 ++- Programs/_testembed.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 4e4912d5cd59d8..84ffd84b9f0bb6 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -942,7 +942,8 @@ Removed * ``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead. * ``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead. * ``Py_SetStandardStreamEncoding()``: set :c:member:`PyConfig.stdio_encoding` - instead, and set also maybe :c:member:`PyConfig.legacy_windows_stdio`. + instead, and set also maybe :c:member:`PyConfig.legacy_windows_stdio` (on + Windows). * ``_Py_SetProgramFullPath()``: set :c:member:`PyConfig.executable` instead. Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 823315ff2034c8..7ee64b22925f0c 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -237,9 +237,11 @@ static void check_stdio_details(const wchar_t *encoding, const wchar_t *errors) if (errors) { config_set_string(&config, &config.stdio_errors, errors); } +#ifdef MS_WINDOWS // gh-106659: On Windows, don't use _io._WindowsConsoleIO which always // announce UTF-8 for sys.stdin.encoding. config.legacy_windows_stdio = 1; +#endif config_set_program_name(&config); init_from_config_clear(&config);