Index: Python/pythonrun.c =================================================================== --- Python/pythonrun.c (revision 77480) +++ Python/pythonrun.c (working copy) @@ -144,7 +144,7 @@ char *errors = NULL; int free_codeset = 0; int overridden = 0; - PyObject *sys_stream, *sys_isatty; + PyObject *sys_stream; #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) char *saved_locale, *loc_codeset; #endif @@ -272,7 +272,7 @@ user's preference, if the CODESET names a well-known Python codec, and Py_FileSystemDefaultEncoding isn't initialized by other means. Also set the encoding of - stdin and stdout if these are terminals, unless overridden. */ + stdin and stdout unless overridden. */ if (!overridden || !Py_FileSystemDefaultEncoding) { saved_locale = strdup(setlocale(LC_CTYPE, NULL)); @@ -318,40 +318,22 @@ if (codeset) { sys_stream = PySys_GetObject("stdin"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if ((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { + if (PyFile_Check(sys_stream)) { if (!PyFile_SetEncodingAndErrors(sys_stream, icodeset, errors)) Py_FatalError("Cannot set codeset of stdin"); } - Py_XDECREF(sys_isatty); sys_stream = PySys_GetObject("stdout"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if ((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { + if (PyFile_Check(sys_stream)) { if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stdout"); } - Py_XDECREF(sys_isatty); sys_stream = PySys_GetObject("stderr"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { + if(PyFile_Check(sys_stream)) { if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stderr"); } - Py_XDECREF(sys_isatty); if (free_codeset) free(codeset);