comparison Python/pythonrun.c @ 61656:ca81646dd29c 3.1

Merged revisions 81250-81253 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81250 | victor.stinner | 2010-05-17 03:13:37 +0200 (lun., 17 mai 2010) | 2 lines Issue #6697: Fix a crash if code of "python -c code" contains surrogates ........ r81251 | victor.stinner | 2010-05-17 03:26:01 +0200 (lun., 17 mai 2010) | 3 lines PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead of strict) error handler to escape surrogates ........ r81252 | victor.stinner | 2010-05-17 10:58:51 +0200 (lun., 17 mai 2010) | 6 lines handle_system_exit() flushs files to warranty the output order PyObject_Print() writes into the C object stderr, whereas PySys_WriteStderr() writes into the Python object sys.stderr. Each object has its own buffer, so call sys.stderr.flush() and fflush(stderr). ........ r81253 | victor.stinner | 2010-05-17 11:33:42 +0200 (lun., 17 mai 2010) | 6 lines Fix refleak in internal_print() introduced by myself in r81251 _PyUnicode_AsDefaultEncodedString() uses a magical PyUnicode attribute to automatically destroy PyUnicode_EncodeUTF8() result when the unicode string is destroyed. ........
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 17 May 2010 09:35:44 +0000
parents 9f62f5865b44
children 3271af035d01
comparison
equal deleted inserted replaced
61650:a33bee14abc5 61656:ca81646dd29c
1351 just let the else clause below print the error. */ 1351 just let the else clause below print the error. */
1352 } 1352 }
1353 if (PyLong_Check(value)) 1353 if (PyLong_Check(value))
1354 exitcode = (int)PyLong_AsLong(value); 1354 exitcode = (int)PyLong_AsLong(value);
1355 else { 1355 else {
1356 PyObject *sys_stderr = PySys_GetObject("stderr");
1357 if (sys_stderr != NULL)
1358 PyObject_CallMethod(sys_stderr, "flush", NULL);
1356 PyObject_Print(value, stderr, Py_PRINT_RAW); 1359 PyObject_Print(value, stderr, Py_PRINT_RAW);
1360 fflush(stderr);
1357 PySys_WriteStderr("\n"); 1361 PySys_WriteStderr("\n");
1358 exitcode = 1; 1362 exitcode = 1;
1359 } 1363 }
1360 done: 1364 done:
1361 /* Restore and clear the exception info, in order to properly decref 1365 /* Restore and clear the exception info, in order to properly decref