Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on

exception (when getting NULL) to an assertion to detect bugs earlier
This commit is contained in:
Victor Stinner 2013-07-12 00:11:58 +02:00
parent c31df04234
commit 365b693adc
1 changed files with 4 additions and 0 deletions

View File

@ -3026,9 +3026,13 @@ error:
why = WHY_EXCEPTION; why = WHY_EXCEPTION;
/* Double-check exception status. */ /* Double-check exception status. */
#ifdef NDEBUG
if (!PyErr_Occurred()) if (!PyErr_Occurred())
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SystemError,
"error return without exception set"); "error return without exception set");
#else
assert(PyErr_Occurred());
#endif
/* Log traceback info. */ /* Log traceback info. */
PyTraceBack_Here(f); PyTraceBack_Here(f);