From: Victor Stinner Date: Thu, 19 Dec 2013 12:47:35 +0000 (+0100) Subject: Better assertion in PyObject_Call() to detect functions returning a result with X-Git-Tag: v3.4.0b2~173^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ac9c00cff2218e56d0d7f6385c4a0fbf9bcd20f;p=thirdparty%2FPython%2Fcpython.git Better assertion in PyObject_Call() to detect functions returning a result with an exception set (invalid state). --- diff --git a/Objects/abstract.c b/Objects/abstract.c index a9c6d6b9e596..38ddb0f3dfed 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2073,7 +2073,8 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) "NULL result without error in PyObject_Call"); } #else - assert(result != NULL || PyErr_Occurred()); + assert((result != NULL && !PyErr_Occurred()) + || (result == NULL && PyErr_Occurred())); #endif return result; }