Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 24539:06f1e2fd05bc legacy-trunk
Patch #534304: Implement phase 1 of PEP 263.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Sun, 04 Aug 2002 17:29:52 +0000 |
| parents | 8ee2ab4f2a2d |
| children | 17e95cc06f69 |
line wrap: on
line diff
--- a/Python/pythonrun.c Sun Aug 04 17:28:33 2002 +0000 +++ b/Python/pythonrun.c Sun Aug 04 17:29:52 2002 +0000 @@ -1221,6 +1221,7 @@ err_input(perrdetail *err) { PyObject *v, *w, *errtype; + PyObject* u = NULL; char *msg = NULL; errtype = PyExc_SyntaxError; v = Py_BuildValue("(ziiz)", err->filename, @@ -1272,12 +1273,24 @@ errtype = PyExc_IndentationError; msg = "too many levels of indentation"; break; + case E_DECODE: { /* XXX */ + PyThreadState* tstate = PyThreadState_Get(); + PyObject* value = tstate->curexc_value; + if (value != NULL) { + u = PyObject_Repr(value); + if (u != NULL) { + msg = PyString_AsString(u); + break; + } + } + } default: fprintf(stderr, "error=%d\n", err->error); msg = "unknown parsing error"; break; } w = Py_BuildValue("(sO)", msg, v); + Py_XDECREF(u); Py_XDECREF(v); PyErr_SetObject(errtype, w); Py_XDECREF(w);
