From: Victor Stinner Date: Thu, 11 Jul 2013 22:11:58 +0000 (+0200) Subject: Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on X-Git-Tag: v3.4.0a1~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=365b693adc1d3a48cfd8e4e93a02ee169096e902;p=python Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on exception (when getting NULL) to an assertion to detect bugs earlier --- diff --git a/Python/ceval.c b/Python/ceval.c index 8396f41cdd..a53e377d4b 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);