summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 72f3be49b6..49e5863d03 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3293,6 +3293,14 @@ jcompile(node *n, char *filename, struct compiling *base)
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;
}