diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_functoolsmodule.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index bf2ea3b..3437353 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -302,8 +302,9 @@ functools_reduce(PyObject *self, PyObject *args) it = PyObject_GetIter(seq); if (it == NULL) { - PyErr_SetString(PyExc_TypeError, - "reduce() arg 2 must support iteration"); + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_SetString(PyExc_TypeError, + "reduce() arg 2 must support iteration"); Py_XDECREF(result); return NULL; } |