diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2021-09-21 17:38:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 17:38:57 (GMT) |
commit | 1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5 (patch) | |
tree | 4532aa4dba2a93d28da804c40889cbe2574faa1a /Python | |
parent | 9a0dcc5b2e04d9c51350107734f12a1cbc0284a7 (diff) | |
download | cpython-1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5.zip cpython-1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5.tar.gz cpython-1c7e98dc258a0e7ccd2325a1aefc4aa2de51e1c5.tar.bz2 |
bpo-24076: Fix reference in sum() introduced by GH-28469 (GH-28493)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 38bdfb2..d0d3180 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2484,7 +2484,8 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start) /* Single digits are common, fast, and cannot overflow on unpacking. */ switch (Py_SIZE(item)) { case -1: b = -(sdigit) ((PyLongObject*)item)->ob_digit[0]; break; - case 0: continue; + // Note: the continue goes to the top of the "while" loop that iterates over the elements + case 0: Py_DECREF(item); continue; case 1: b = ((PyLongObject*)item)->ob_digit[0]; break; default: b = PyLong_AsLongAndOverflow(item, &overflow); break; } |