]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
When returning an error from jcompile() (which is passed through by
authorGuido van Rossum <guido@python.org>
Mon, 7 Aug 2000 19:22:43 +0000 (19:22 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 7 Aug 2000 19:22:43 +0000 (19:22 +0000)
PyNode_Compile()), make sure that an exception is actually set --
otherwise someone stomped on our error.  [2.0 checkin of this fix.]

Python/compile.c

index 72f3be49b64f382f39703b042417f7b7c8461ad8..49e5863d03b3a258d0b6e75d186f674618554a6c 100644 (file)
@@ -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;
 }