From efde146b0c42f2643f96d00896c99a90d501fb69 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 21 Mar 2015 15:04:43 +0100 Subject: 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. --- Python/ceval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index 25fbc0fc79..d68cdc6292 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); -- cgit v1.2.1