]> granicus.if.org Git - python/commitdiff
Better assertion in PyObject_Call() to detect functions returning a result with
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 19 Dec 2013 12:47:35 +0000 (13:47 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 19 Dec 2013 12:47:35 +0000 (13:47 +0100)
an exception set (invalid state).

Objects/abstract.c

index a9c6d6b9e596e881312b6a04fc262d4ae0fe14ab..38ddb0f3dfed8a02faec880492b7a23ba632f5df 100644 (file)
@@ -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;
     }