Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now

raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.

Refactor also PyObject_Call() and PyCFunction_Call() to make them more readable.

Remove some checks which became useless (duplicate checks).

Change reviewed by Serhiy Storchaka.
This commit is contained in:
Victor Stinner 2015-03-06 23:35:27 +01:00
parent d81431f587
commit 4a7cc88472
7 changed files with 129 additions and 100 deletions

View file

@ -680,11 +680,7 @@ static void
_set_BlockingIOError(char *msg, Py_ssize_t written)
{
PyObject *err;
#ifdef Py_DEBUG
/* in debug mode, PyEval_EvalFrameEx() fails with an assertion error
if an exception is set when it is called */
PyErr_Clear();
#endif
err = PyObject_CallFunction(PyExc_BlockingIOError, "isn",
errno, msg, written);
if (err)