gh-93937: PyOS_StdioReadline() uses PyConfig.legacy_windows_stdio (#94024)

On Windows, PyOS_StdioReadline() now gets
PyConfig.legacy_windows_stdio from _PyOS_ReadlineTState, rather than
using the deprecated global Py_LegacyWindowsStdioFlag variable.

Fix also a compiler warning in Py_SetStandardStreamEncoding().
This commit is contained in:
Victor Stinner 2022-06-20 16:10:47 +02:00 committed by GitHub
parent 7ad6f74fcf
commit cfb986a1a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -247,7 +247,8 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
assert(tstate != NULL);
#ifdef MS_WINDOWS
if (!Py_LegacyWindowsStdioFlag && sys_stdin == stdin) {
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
if (!config->legacy_windows_stdio && sys_stdin == stdin) {
HANDLE hStdIn, hStdErr;
hStdIn = _Py_get_osfhandle_noraise(fileno(sys_stdin));