mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Issue #22290: PyObject_Call() now fails with an assertion error when called
with an exception set. This new assertion helps to understand if the exception was already set before calling the function or raised by the function.
This commit is contained in:
parent
47e40429fb
commit
8f4ec8d3ef
1 changed files with 5 additions and 0 deletions
|
|
@ -2074,6 +2074,11 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
|
|||
{
|
||||
ternaryfunc call;
|
||||
|
||||
/* PyObject_Call() must not be called with an exception set,
|
||||
because it may clear it (directly or indirectly) and so the
|
||||
caller looses its exception */
|
||||
assert(!PyErr_Occurred());
|
||||
|
||||
if ((call = func->ob_type->tp_call) != NULL) {
|
||||
PyObject *result;
|
||||
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue