mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) in the exception message. Add also unit test to check that the exception contains the name of the function. Special case: the final _PyEval_EvalFrameEx() check doesn't mention the function since it didn't execute a single function but a whole frame.
This commit is contained in:
parent
6921c13bbb
commit
efde146b0c
6 changed files with 93 additions and 12 deletions
|
@ -3253,7 +3253,7 @@ exit_eval_frame:
|
|||
f->f_executing = 0;
|
||||
tstate->frame = f->f_back;
|
||||
|
||||
return _Py_CheckFunctionResult(retval, "PyEval_EvalFrameEx");
|
||||
return _Py_CheckFunctionResult(NULL, retval, "PyEval_EvalFrameEx");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4251,14 +4251,14 @@ call_function(PyObject ***pp_stack, int oparg
|
|||
if (flags & METH_NOARGS && na == 0) {
|
||||
C_TRACE(x, (*meth)(self,NULL));
|
||||
|
||||
x = _Py_CheckFunctionResult(x, "call_function");
|
||||
x = _Py_CheckFunctionResult(func, x, NULL);
|
||||
}
|
||||
else if (flags & METH_O && na == 1) {
|
||||
PyObject *arg = EXT_POP(*pp_stack);
|
||||
C_TRACE(x, (*meth)(self,arg));
|
||||
Py_DECREF(arg);
|
||||
|
||||
x = _Py_CheckFunctionResult(x, "call_function");
|
||||
x = _Py_CheckFunctionResult(func, x, NULL);
|
||||
}
|
||||
else {
|
||||
err_args(func, flags, na);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue