[Python-checkins] python/dist/src/Python pythonrun.c, 2.195.6.4, 2.195.6.5

arigo at users.sourceforge.net arigo at users.sourceforge.net
Mon Mar 22 15:41:50 EST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19489
Modified Files:
 Tag: release23-maint
	pythonrun.c 
Log Message:
Backport for bug fix of 2.204.
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.195.6.4
retrieving revision 2.195.6.5
diff -C2 -d -r2.195.6.4 -r2.195.6.5
*** pythonrun.c	1 Dec 2003 22:13:12 -0000	2.195.6.4
--- pythonrun.c	22 Mar 2004 20:41:47 -0000	2.195.6.5
***************
*** 1099,1104 ****
 {
 	int err = 0;
- 	PyObject *v = value;
 	PyObject *f = PySys_GetObject("stderr");
 	if (f == NULL)
 		fprintf(stderr, "lost sys.stderr\n");
--- 1099,1104 ----
 {
 	int err = 0;
 	PyObject *f = PySys_GetObject("stderr");
+ 	Py_INCREF(value);
 	if (f == NULL)
 		fprintf(stderr, "lost sys.stderr\n");
***************
*** 1110,1119 ****
 			err = PyTraceBack_Print(tb, f);
 		if (err == 0 &&
! 		 PyObject_HasAttrString(v, "print_file_and_line"))
 		{
 			PyObject *message;
 			const char *filename, *text;
 			int lineno, offset;
! 			if (!parse_syntax_error(v, &message, &filename,
 						&lineno, &offset, &text))
 				PyErr_Clear();
--- 1110,1119 ----
 			err = PyTraceBack_Print(tb, f);
 		if (err == 0 &&
! 		 PyObject_HasAttrString(value, "print_file_and_line"))
 		{
 			PyObject *message;
 			const char *filename, *text;
 			int lineno, offset;
! 			if (!parse_syntax_error(value, &message, &filename,
 						&lineno, &offset, &text))
 				PyErr_Clear();
***************
*** 1131,1135 ****
 				if (text != NULL)
 					print_error_text(f, offset, text);
! 				v = message;
 				/* Can't be bothered to check all those
 				 PyFile_WriteString() calls */
--- 1131,1136 ----
 				if (text != NULL)
 					print_error_text(f, offset, text);
! 				Py_DECREF(value);
! 				value = message;
 				/* Can't be bothered to check all those
 				 PyFile_WriteString() calls */
***************
*** 1168,1173 ****
 			err = PyFile_WriteObject(exception, f, Py_PRINT_RAW);
 		if (err == 0) {
! 			if (v != NULL && v != Py_None) {
! 				PyObject *s = PyObject_Str(v);
 				/* only print colon if the str() of the
 				 object is not the empty string
--- 1169,1174 ----
 			err = PyFile_WriteObject(exception, f, Py_PRINT_RAW);
 		if (err == 0) {
! 			if (value != Py_None) {
! 				PyObject *s = PyObject_Str(value);
 				/* only print colon if the str() of the
 				 object is not the empty string
***************
*** 1186,1189 ****
--- 1187,1191 ----
 			err = PyFile_WriteString("\n", f);
 	}
+ 	Py_DECREF(value);
 	/* If an error happened here, don't show it.
 	 XXX This is wrong, but too many callers rely on this behavior. */


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /