test_python_legacy_windows_stdio
in test_cmd_line
isn't actually working
#133374
Labels
test_python_legacy_windows_stdio
in test_cmd_line
isn't actually working
#133374
PYTHONLEGACYWINDOWSSTDIO
will let Windows use old console IO forstdin
andstdout
, andsys.stdin.encoding
will becomecp
instead ofutf-8
.cpython/Lib/test/test_cmd_line.py
Lines 974 to 978 in 0af61fe
In this test, it sets
PYTHONLEGACYWINDOWSSTDIO
to1
and creates a new Python process to check ifsys.stdin.encoding
iscp
. However, the new process is created bysubprocess.Popen
withstdin=PIPE, stdout=PIPE
, thus thesys.stdin
andsys.stdout
will not be console IO, so their encoding is always the current console code page (cp
) whetherPYTHONLEGACYWINDOWSSTDIO
is set or not. So actually nothing has been tested.Another issue with this test is that it expects the encoding to be
cp
, but on some non-English locale Windows environments, for example, Simplified Chinese locale, it will begbk
, and the test will fail.A fix is on the way.
Linked PRs
The text was updated successfully, but these errors were encountered: