diff Modules/_functoolsmodule.c @ 64074:dee30c46739e 3.1

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. ........
author Alexander Belopolsky <alexander.belopolsky@gmail.com>
date Mon, 16 Aug 2010 19:46:32 +0000
parents f197407bdba2
children bf94b6a73fc8 2baad8bd0b4f
line wrap: on
line diff
--- a/Modules/_functoolsmodule.c	Mon Aug 16 05:09:31 2010 +0000
+++ b/Modules/_functoolsmodule.c	Mon Aug 16 19:46:32 2010 +0000
@@ -302,8 +302,9 @@
 
     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;
     }