From: Victor Stinner Date: Wed, 18 Jan 2017 13:06:38 +0000 (+0100) Subject: _PyObject_FastCallKeywords() now checks !PyErr_Occurred() X-Git-Tag: v3.7.0a1~1517 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98ccba8344a349d1bbc27718215156478ffa19ed;p=python _PyObject_FastCallKeywords() now checks !PyErr_Occurred() Issue #29259. All other functions calling functions start with the similar assertion. --- diff --git a/Objects/abstract.c b/Objects/abstract.c index 4b32fedccf..1132b842ca 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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));