comparison 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
comparison
equal deleted inserted replaced
7508:eda0ca138b3d 7509:b5d52c415b15
674 674
675 if (exception == NULL) 675 if (exception == NULL)
676 return; 676 return;
677 677
678 if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) { 678 if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) {
679 err = Py_FlushLine(); 679 if (Py_FlushLine())
680 PyErr_Clear();
680 fflush(stdout); 681 fflush(stdout);
681 if (v == NULL || v == Py_None) 682 if (v == NULL || v == Py_None)
682 Py_Exit(0); 683 Py_Exit(0);
683 if (PyInstance_Check(v)) { 684 if (PyInstance_Check(v)) {
684 /* we expect the error code to be store in the 685 /* we expect the error code to be store in the
712 } 713 }
713 f = PySys_GetObject("stderr"); 714 f = PySys_GetObject("stderr");
714 if (f == NULL) 715 if (f == NULL)
715 fprintf(stderr, "lost sys.stderr\n"); 716 fprintf(stderr, "lost sys.stderr\n");
716 else { 717 else {
717 err = Py_FlushLine(); 718 if (Py_FlushLine())
719 PyErr_Clear();
718 fflush(stdout); 720 fflush(stdout);
719 if (err == 0) 721 err = PyTraceBack_Print(tb, f);
720 err = PyTraceBack_Print(tb, f);
721 if (err == 0 && 722 if (err == 0 &&
722 PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) 723 PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError))
723 { 724 {
724 PyObject *message; 725 PyObject *message;
725 char *filename, *text; 726 char *filename, *text;
1060 PyErr_Print(); 1061 PyErr_Print();
1061 } 1062 }
1062 Py_DECREF(exitfunc); 1063 Py_DECREF(exitfunc);
1063 } 1064 }
1064 1065
1065 Py_FlushLine(); 1066 if (Py_FlushLine())
1067 PyErr_Clear();
1066 } 1068 }
1067 1069
1068 static void 1070 static void
1069 call_ll_exitfuncs() 1071 call_ll_exitfuncs()
1070 { 1072 {