summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-08-16 18:55:46 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-08-16 18:55:46 (GMT)
commite29e6bffb577233c0e327f831c037ebf92da0157 (patch)
treef3b58faa1e924dbd606f0354b11b7488d520d155 /Modules
parent27354ccec97f9aa79449397cd29f7d70b8e9f445 (diff)
downloadcpython-e29e6bffb577233c0e327f831c037ebf92da0157.zip
cpython-e29e6bffb577233c0e327f831c037ebf92da0157.tar.gz
cpython-e29e6bffb577233c0e327f831c037ebf92da0157.tar.bz2
Issue #665761: functools.reduce() will no longer mask exceptions other
than TypeError raised by the iterator argument. Also added a test to check that zip() already behaves similarly.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_functoolsmodule.c5
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;
}