[Python-checkins] python/dist/src/Python pythonrun.c,2.215,2.216

loewis@users.sourceforge.net loewis at users.sourceforge.net
Wed Aug 24 10:39:34 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3014/Python
Modified Files:
	pythonrun.c 
Log Message:
Forward UnicodeDecodeError into SyntaxError for source encoding errors.
Will backport to 2.4.
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.215
retrieving revision 2.216
diff -u -d -r2.215 -r2.216
--- pythonrun.c	1 Aug 2005 21:39:29 -0000	2.215
+++ pythonrun.c	24 Aug 2005 08:39:24 -0000	2.216
@@ -1474,18 +1474,20 @@
 		errtype = PyExc_IndentationError;
 		msg = "too many levels of indentation";
 		break;
-	case E_DECODE: {	/* XXX */
-		PyThreadState* tstate = PyThreadState_GET();
-		PyObject* value = tstate->curexc_value;
+	case E_DECODE: {
+		PyObject *type, *value, *tb;
+		PyErr_Fetch(&type, &value, &tb);
 		if (value != NULL) {
-			u = PyObject_Repr(value);
+			u = PyObject_Str(value);
 			if (u != NULL) {
 				msg = PyString_AsString(u);
-				break;
 			}
 		}
 		if (msg == NULL)
 			msg = "unknown decode error";
+		Py_DECREF(type);
+		Py_DECREF(value);
+		Py_DECREF(tb);
 		break;
 	}
 	case E_LINECONT:


More information about the Python-checkins mailing list

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