Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 61922:8dbbd90eeda8 2.6
Merged revisions 81537 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81537 | victor.stinner | 2010-05-26 00:30:32 +0200 (mer., 26 mai 2010) | 3 lines
Issue #3798: Write sys.exit() message to sys.stderr to use stderr encoding and
error handler, instead of writing to the C stderr file in utf-8
........
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 25 May 2010 22:40:38 +0000 |
| parents | e38335d4df91 |
| children | 787b969d37f0 |
comparison
equal
deleted
inserted
replaced
| 61912:55dc9ef15ab1 | 61922:8dbbd90eeda8 |
|---|---|
| 1109 just let the else clause below print the error. */ | 1109 just let the else clause below print the error. */ |
| 1110 } | 1110 } |
| 1111 if (PyInt_Check(value)) | 1111 if (PyInt_Check(value)) |
| 1112 exitcode = (int)PyInt_AsLong(value); | 1112 exitcode = (int)PyInt_AsLong(value); |
| 1113 else { | 1113 else { |
| 1114 PyObject_Print(value, stderr, Py_PRINT_RAW); | 1114 PyObject *sys_stderr = PySys_GetObject("stderr"); |
| 1115 if (sys_stderr != NULL && sys_stderr != Py_None) { | |
| 1116 PyFile_WriteObject(value, sys_stderr, Py_PRINT_RAW); | |
| 1117 } else { | |
| 1118 PyObject_Print(value, stderr, Py_PRINT_RAW); | |
| 1119 fflush(stderr); | |
| 1120 } | |
| 1115 PySys_WriteStderr("\n"); | 1121 PySys_WriteStderr("\n"); |
| 1116 exitcode = 1; | 1122 exitcode = 1; |
| 1117 } | 1123 } |
| 1118 done: | 1124 done: |
| 1119 /* Restore and clear the exception info, in order to properly decref | 1125 /* Restore and clear the exception info, in order to properly decref |
