From 365b693adc1d3a48cfd8e4e93a02ee169096e902 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 12 Jul 2013 00:11:58 +0200 Subject: Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on exception (when getting NULL) to an assertion to detect bugs earlier --- Python/ceval.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index 8396f41..a53e377 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3026,9 +3026,13 @@ error: why = WHY_EXCEPTION; /* Double-check exception status. */ +#ifdef NDEBUG if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, "error return without exception set"); +#else + assert(PyErr_Occurred()); +#endif /* Log traceback info. */ PyTraceBack_Here(f); -- cgit v0.12