Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c7e98d

Browse files
authored
bpo-24076: Fix reference in sum() introduced by GH-28469 (GH-28493)
1 parent 9a0dcc5 commit 1c7e98d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/bltinmodule.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2484,7 +2484,8 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
24842484
/* Single digits are common, fast, and cannot overflow on unpacking. */
24852485
switch (Py_SIZE(item)) {
24862486
case -1: b = -(sdigit) ((PyLongObject*)item)->ob_digit[0]; break;
2487-
case 0: continue;
2487+
// Note: the continue goes to the top of the "while" loop that iterates over the elements
2488+
case 0: Py_DECREF(item); continue;
24882489
case 1: b = ((PyLongObject*)item)->ob_digit[0]; break;
24892490
default: b = PyLong_AsLongAndOverflow(item, &overflow); break;
24902491
}

0 commit comments

Comments
 (0)