diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-08-16 19:46:32 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-08-16 19:46:32 (GMT) |
commit | 7a9bdbc1c2214bec2133139dd8830f17e0383eed (patch) | |
tree | a332279d11accbf9106fb82bed646eaff4769773 /Modules/_functoolsmodule.c | |
parent | 5b37ce64c1a8108406cd0ae19e15b9ebd855c2f6 (diff) | |
download | cpython-7a9bdbc1c2214bec2133139dd8830f17e0383eed.zip cpython-7a9bdbc1c2214bec2133139dd8830f17e0383eed.tar.gz cpython-7a9bdbc1c2214bec2133139dd8830f17e0383eed.tar.bz2 |
Merged revisions 84098 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84098 | alexander.belopolsky | 2010-08-16 14:55:46 -0400 (Mon, 16 Aug 2010) | 4 lines
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/_functoolsmodule.c')
-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; } |