Issue #18408: add more assertions on PyErr_Occurred() in ceval.c to detect bugs

earlier
This commit is contained in:
Victor Stinner 2013-07-16 01:02:12 +02:00
parent ceceaa00ba
commit f243ee4055
2 changed files with 5 additions and 2 deletions

View File

@ -2111,8 +2111,7 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
"NULL result without error in PyObject_Call");
}
#else
if (result == NULL)
assert(PyErr_Occurred());
assert(result != NULL || PyErr_Occurred());
#endif
return result;
}

View File

@ -4216,6 +4216,8 @@ call_function(PyObject ***pp_stack, int oparg
READ_TIMESTAMP(*pintr1);
Py_DECREF(func);
}
assert((x != NULL && !PyErr_Occurred())
|| (x == NULL && PyErr_Occurred()));
/* Clear the stack of the function object. Also removes
the arguments in case they weren't consumed already
@ -4509,6 +4511,8 @@ ext_call_fail:
Py_XDECREF(callargs);
Py_XDECREF(kwdict);
Py_XDECREF(stararg);
assert((result != NULL && !PyErr_Occurred())
|| (result == NULL && PyErr_Occurred()));
return result;
}