summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-11 22:11:58 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-11 22:11:58 (GMT)
commit365b693adc1d3a48cfd8e4e93a02ee169096e902 (patch)
treee2e5f3e39cf37fb92eb02101dc67b6a8d920dad7 /Python/ceval.c
parentc31df042340ed97b38d6364d4ee5a8d74aafca01 (diff)
downloadcpython-365b693adc1d3a48cfd8e4e93a02ee169096e902.zip
cpython-365b693adc1d3a48cfd8e4e93a02ee169096e902.tar.gz
cpython-365b693adc1d3a48cfd8e4e93a02ee169096e902.tar.bz2
Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on
exception (when getting NULL) to an assertion to detect bugs earlier
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c4
1 files changed, 4 insertions, 0 deletions
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);