Core and builtins
-----------------
+- Bug #1421664: sys.stderr.encoding is now set to the same value as
+ sys.stdout.encoding.
+
- __import__ accepts keyword arguments.
- Patch #1460496: round() now accepts keyword arguments.
}
Py_XDECREF(sys_isatty);
+ sys_stream = PySys_GetObject("stderr");
+ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", "");
+ if (!sys_isatty)
+ PyErr_Clear();
+ if(sys_isatty && PyObject_IsTrue(sys_isatty)) {
+ if (!PyFile_SetEncoding(sys_stream, codeset))
+ Py_FatalError("Cannot set codeset of stderr");
+ }
+ Py_XDECREF(sys_isatty);
+
if (!Py_FileSystemDefaultEncoding)
Py_FileSystemDefaultEncoding = codeset;
else
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);