From: Guido van Rossum Date: Sat, 28 Feb 1998 04:31:39 +0000 (+0000) Subject: Fix the handling of errors in Py_FlushLine() in a few places. X-Git-Tag: v1.5.1~545 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0829c754bbb7b3ea66801c7da69f6cb189b80543;p=thirdparty%2FPython%2Fcpython.git Fix the handling of errors in Py_FlushLine() in a few places. (Basically, the error is cleared... Like almost everywhere else...) --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 4cd0e3f3c24a..83a0bc14725a 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -676,7 +676,8 @@ PyErr_PrintEx(set_sys_last_vars) return; if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) { - err = Py_FlushLine(); + if (Py_FlushLine()) + PyErr_Clear(); fflush(stdout); if (v == NULL || v == Py_None) Py_Exit(0); @@ -714,10 +715,10 @@ PyErr_PrintEx(set_sys_last_vars) if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); else { - err = Py_FlushLine(); + if (Py_FlushLine()) + PyErr_Clear(); fflush(stdout); - if (err == 0) - err = PyTraceBack_Print(tb, f); + err = PyTraceBack_Print(tb, f); if (err == 0 && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) { @@ -1062,7 +1063,8 @@ call_sys_exitfunc() Py_DECREF(exitfunc); } - Py_FlushLine(); + if (Py_FlushLine()) + PyErr_Clear(); } static void