Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 365b693

Browse files
committed
Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on
exception (when getting NULL) to an assertion to detect bugs earlier
1 parent c31df04 commit 365b693

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,9 +3026,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
30263026
why = WHY_EXCEPTION;
30273027

30283028
/* Double-check exception status. */
3029+
#ifdef NDEBUG
30293030
if (!PyErr_Occurred())
30303031
PyErr_SetString(PyExc_SystemError,
30313032
"error return without exception set");
3033+
#else
3034+
assert(PyErr_Occurred());
3035+
#endif
30323036

30333037
/* Log traceback info. */
30343038
PyTraceBack_Here(f);

0 commit comments

Comments
 (0)