]> granicus.if.org Git - python/commitdiff
_PyObject_FastCallKeywords() now checks !PyErr_Occurred()
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 18 Jan 2017 13:06:38 +0000 (14:06 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 18 Jan 2017 13:06:38 +0000 (14:06 +0100)
Issue #29259. All other functions calling functions start with the similar
assertion.

Objects/abstract.c

index 4b32fedccf000cd0f0ccd46dc78a5b8b609f641c..1132b842ca192dd3c4575a9c7c5d28fd2285babb 100644 (file)
@@ -2482,6 +2482,11 @@ PyObject *
 _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
                            PyObject *kwnames)
 {
+    /* _PyObject_FastCallKeywords() must not be called with an exception set,
+       because it can clear it (directly or indirectly) and so the
+       caller loses its exception */
+    assert(!PyErr_Occurred());
+
     assert(nargs >= 0);
     assert(kwnames == NULL || PyTuple_CheckExact(kwnames));