mirror of
https://github.com/python/cpython.git
synced 2025-09-10 10:47:34 +00:00
Bug #1421664: Set sys.stderr.encoding
This commit is contained in:
parent
cf0a2a8576
commit
ea62d2535f
3 changed files with 18 additions and 0 deletions
|
@ -1069,6 +1069,11 @@ _PySys_Init(void)
|
|||
if (!PyFile_SetEncoding(sysout, buf))
|
||||
return NULL;
|
||||
}
|
||||
if(isatty(_fileno(stderr))) {
|
||||
sprintf(buf, "cp%d", GetConsoleOutputCP());
|
||||
if (!PyFile_SetEncoding(syserr, buf))
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
PyDict_SetItemString(sysdict, "stdin", sysin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue