Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 37423:57b1ff138995 legacy-trunk
Bug #1421664: Set sys.stderr.encoding
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 03 Apr 2006 10:56:49 +0000 |
| parents | 91a9e2e31e93 |
| children | 65ecb83ea7dd |
line wrap: on
line diff
--- a/Python/sysmodule.c Mon Apr 03 08:10:33 2006 +0000 +++ b/Python/sysmodule.c Mon Apr 03 10:56:49 2006 +0000 @@ -1069,6 +1069,11 @@ 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);
