You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test test_embed fails on Windows 11, Python 3.13.0a0 #106659
The test doesn't override sys.stdin in the child process. Thus when it's run normally, stdin is a console file. By default, the raw type of a console file is io._WindowsConsoleIO, which always uses UTF-8. The test expects to be able to override this, but being able to do this will either require forcing stdin to be a pipe or nul or it will require defining the environment variable PYTHONLEGACYWINDOWSSTDIO. The latter forces the use of io.FileIO for console files, instead of io._WindowsConsoleIO.
Oh thanks for the bisect! I wrote PR #108010 to fix the regression. I'm able to reproduce the test failure on Windows when I run the test manually in a terminal.
The test expects to be able to override this, but being able to do this will either require forcing stdin to be a pipe or nul or it will require defining the environment variable PYTHONLEGACYWINDOWSSTDIO.
The removed Py_SetStandardStreamEncoding() function did set Py_LegacyWindowsStdioFlag:
/* Overriding the stream encoding implies legacy streams */Py_LegacyWindowsStdioFlag=1;
Activity
eryksun commentedon Jul 12, 2023
The test doesn't override
sys.stdinin the child process. Thus when it's run normally,stdinis a console file. By default, the raw type of a console file isio._WindowsConsoleIO, which always uses UTF-8. The test expects to be able to override this, but being able to do this will either require forcingstdinto be a pipe or nul or it will require defining the environment variablePYTHONLEGACYWINDOWSSTDIO. The latter forces the use ofio.FileIOfor console files, instead ofio._WindowsConsoleIO.Eclips4 commentedon Aug 15, 2023
Bisected to #105154
cc @vstinner
pythongh-106659: Fix test_embed.test_forced_io_encoding() on Windows
vstinner commentedon Aug 16, 2023
Oh thanks for the bisect! I wrote PR #108010 to fix the regression. I'm able to reproduce the test failure on Windows when I run the test manually in a terminal.
vstinner commentedon Aug 16, 2023
The removed
Py_SetStandardStreamEncoding()function did set Py_LegacyWindowsStdioFlag:I missed that in my change. My PR fix it.
gh-106659: Fix test_embed.test_forced_io_encoding() on Windows (#108010)
vstinner commentedon Aug 16, 2023
It should now be fixed. Thanks for your bug report! Thanks @Eclips4 for your review on my PR.