[Python-checkins] python/dist/src/Python pythonrun.c, 2.211.2.1, 2.211.2.2

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


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3103/Python

Modified Files:
      Tag: release24-maint
	pythonrun.c 
Log Message:
Forward UnicodeDecodeError into SyntaxError for source encoding errors.


Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.211.2.1
retrieving revision 2.211.2.2
diff -u -d -r2.211.2.1 -r2.211.2.2
--- pythonrun.c	29 Mar 2005 12:32:50 -0000	2.211.2.1
+++ pythonrun.c	24 Aug 2005 08:39:46 -0000	2.211.2.2
@@ -1471,18 +1471,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;
 	}
 	default:



More information about the Python-checkins mailing list