diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-04 23:10:29 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-04 23:10:29 (GMT) |
commit | 8f4ec8d3ef9a75d7238c93cb55fdfcd0fe4ddc02 (patch) | |
tree | 1c8171082d5ed865bac9c71f8aa1b08f6f6c708b | |
parent | 47e40429fbebb7c0751c5cb20d666089b05710c6 (diff) | |
download | cpython-8f4ec8d3ef9a75d7238c93cb55fdfcd0fe4ddc02.zip cpython-8f4ec8d3ef9a75d7238c93cb55fdfcd0fe4ddc02.tar.gz cpython-8f4ec8d3ef9a75d7238c93cb55fdfcd0fe4ddc02.tar.bz2 |
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.
-rw-r--r-- | Objects/abstract.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 783a83c..ec59972 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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")) |