diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-08-04 17:29:52 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-08-04 17:29:52 (GMT) |
commit | 00f1e3f5a54adb0a7159a446edeca2e36da4092e (patch) | |
tree | 86d731c4fd7c0141686044f5eefbb7f475da9647 /Python/pythonrun.c | |
parent | a729daf2e43f3ffa2d1b3b6cd31491c840091e66 (diff) | |
download | cpython-00f1e3f5a54adb0a7159a446edeca2e36da4092e.zip cpython-00f1e3f5a54adb0a7159a446edeca2e36da4092e.tar.gz cpython-00f1e3f5a54adb0a7159a446edeca2e36da4092e.tar.bz2 |
Patch #534304: Implement phase 1 of PEP 263.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index b1fde29..006ff08 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1221,6 +1221,7 @@ static void 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 @@ 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; + 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); |