diff Python/pythonrun.c @ 7509:b5d52c415b15 legacy-trunk

Fix the handling of errors in Py_FlushLine() in a few places. (Basically, the error is cleared... Like almost everywhere else...)
author Guido van Rossum <guido@python.org>
date Sat, 28 Feb 1998 04:31:39 +0000
parents 3f255aedf621
children 3c4f736d5e01
line wrap: on
line diff
--- a/Python/pythonrun.c	Fri Feb 27 22:13:13 1998 +0000
+++ b/Python/pythonrun.c	Sat Feb 28 04:31:39 1998 +0000
@@ -676,7 +676,8 @@
 		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 @@
 	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 @@
 		Py_DECREF(exitfunc);
 	}
 
-	Py_FlushLine();
+	if (Py_FlushLine())
+		PyErr_Clear();
 }
 
 static void