Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.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 | 89142cadcfb9 |
| children | 65ecb83ea7dd |
comparison
equal
deleted
inserted
replaced
| 37422:e956e16e7444 | 37423:57b1ff138995 |
|---|---|
| 276 if (!sys_isatty) | 276 if (!sys_isatty) |
| 277 PyErr_Clear(); | 277 PyErr_Clear(); |
| 278 if(sys_isatty && PyObject_IsTrue(sys_isatty)) { | 278 if(sys_isatty && PyObject_IsTrue(sys_isatty)) { |
| 279 if (!PyFile_SetEncoding(sys_stream, codeset)) | 279 if (!PyFile_SetEncoding(sys_stream, codeset)) |
| 280 Py_FatalError("Cannot set codeset of stdout"); | 280 Py_FatalError("Cannot set codeset of stdout"); |
| 281 } | |
| 282 Py_XDECREF(sys_isatty); | |
| 283 | |
| 284 sys_stream = PySys_GetObject("stderr"); | |
| 285 sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); | |
| 286 if (!sys_isatty) | |
| 287 PyErr_Clear(); | |
| 288 if(sys_isatty && PyObject_IsTrue(sys_isatty)) { | |
| 289 if (!PyFile_SetEncoding(sys_stream, codeset)) | |
| 290 Py_FatalError("Cannot set codeset of stderr"); | |
| 281 } | 291 } |
| 282 Py_XDECREF(sys_isatty); | 292 Py_XDECREF(sys_isatty); |
| 283 | 293 |
| 284 if (!Py_FileSystemDefaultEncoding) | 294 if (!Py_FileSystemDefaultEncoding) |
| 285 Py_FileSystemDefaultEncoding = codeset; | 295 Py_FileSystemDefaultEncoding = codeset; |
