Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 13884:8eeaff96b4c2 legacy-trunk
When returning an error from jcompile() (which is passed through by
PyNode_Compile()), make sure that an exception is actually set --
otherwise someone stomped on our error. [2.0 checkin of this fix.]
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 07 Aug 2000 19:22:43 +0000 |
| parents | d014c8ab6a82 |
| children | 4eaa463c031a |
line wrap: on
line diff
--- a/Python/compile.c Mon Aug 07 19:18:27 2000 +0000 +++ b/Python/compile.c Mon Aug 07 19:22:43 2000 +0000 @@ -3293,6 +3293,14 @@ Py_XDECREF(filename); Py_XDECREF(name); } + else if (!PyErr_Occurred()) { + /* This could happen if someone called PyErr_Clear() after an + error was reported above. That's not supposed to happen, + but I just plugged one case and I'm not sure there can't be + others. In that case, raise SystemError so that at least + it gets reported instead dumping core. */ + PyErr_SetString(PyExc_SystemError, "lost syntax error"); + } com_free(&sc); return co; }
