mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Forward UnicodeDecodeError into SyntaxError for source encoding errors.
Will backport to 2.4.
This commit is contained in:
@@ -1474,18 +1474,20 @@ err_input(perrdetail *err)
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user