summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-15 15:50:07 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-15 15:50:07 (GMT)
commit3de58698647221df4dc0d198bb512e7e80eec818 (patch)
tree621c1063e527bf8e4d1c3404c1b59c9c678c6a20 /Objects
parent33283ba3009ae1f67a73a0a6113d449ef11d039f (diff)
downloadcpython-3de58698647221df4dc0d198bb512e7e80eec818.zip
cpython-3de58698647221df4dc0d198bb512e7e80eec818.tar.gz
cpython-3de58698647221df4dc0d198bb512e7e80eec818.tar.bz2
Issue #18408: PyObject_Call() now fails with an assertion error in debug mode
if the function called failed whereas no exception was raised, to detect bugs earlier.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 244dcaf..6896600 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2104,10 +2104,16 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
return NULL;
result = (*call)(func, arg, kw);
Py_LeaveRecursiveCall();
- if (result == NULL && !PyErr_Occurred())
+#ifdef NDEBUG
+ if (result == NULL && !PyErr_Occurred()) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
+ }
+#else
+ if (result == NULL)
+ assert(PyErr_Occurred());
+#endif
return result;
}
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",