mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
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.
This commit is contained in:
parent
27354ccec9
commit
e29e6bffb5
4 changed files with 26 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue