mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595) (GH-28604)
(cherry picked from commit 84975146a7
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
fe7746c61a
commit
cd00fee8dd
2 changed files with 15 additions and 14 deletions
|
@ -2969,14 +2969,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_One;
|
||||
}
|
||||
Py_INCREF(result);
|
||||
#ifndef SLOW_PROD
|
||||
/* Fast paths for integers keeping temporary products in C.
|
||||
* Assumes all inputs are the same type.
|
||||
|
@ -2992,7 +2987,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue