Kaydet (Commit) 6c2f0c73 authored tarafından Guido van Rossum's avatar Guido van Rossum

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.]
üst ed473a46
...@@ -3293,6 +3293,14 @@ jcompile(node *n, char *filename, struct compiling *base) ...@@ -3293,6 +3293,14 @@ jcompile(node *n, char *filename, struct compiling *base)
Py_XDECREF(filename); Py_XDECREF(filename);
Py_XDECREF(name); 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); com_free(&sc);
return co; return co;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment