bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595)

This commit is contained in:
Pablo Galindo Salgado 2021-09-28 13:32:43 +01:00 committed by GitHub
parent e649e0658f
commit 84975146a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 14 deletions

View file

@ -3082,14 +3082,9 @@ math_prod_impl(PyObject *module, PyObject *iterable, PyObject *start)
}
if (result == NULL) {
result = PyLong_FromLong(1);
if (result == NULL) {
Py_DECREF(iter);
return NULL;
}
} else {
Py_INCREF(result);
result = _PyLong_GetOne();
}
Py_INCREF(result);
#ifndef SLOW_PROD
/* Fast paths for integers keeping temporary products in C.
* Assumes all inputs are the same type.
@ -3105,7 +3100,7 @@ math_prod_impl(PyObject *module, PyObject *iterable, PyObject *start)
}
/* Loop over all the items in the iterable until we finish, we overflow
* or we found a non integer element */
while(result == NULL) {
while (result == NULL) {
item = PyIter_Next(iter);
if (item == NULL) {
Py_DECREF(iter);