8000 bpo-24076: Fix reference in sum() introduced by GH-28469 by pablogsal · Pull Request #28493 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-24076: Fix reference in sum() introduced by GH-28469 #28493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2021

Conversation

pablogsal
Copy link
Member
@pablogsal pablogsal commented Sep 21, 2021

@@ -2484,7 +2484,7 @@ 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;
case 0: Py_DECREF(item); continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that the "continue" warrants a comment. Inside a switch-case, a break ends a case but a continue means to go to the top of the loop. The side-by-side use of break and continue is a bit confusing (I did a double take when I first saw it); hence, my suggestion to add a comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I actually didn't add it before to keep the PR contained. But makes sense. I have pushed a comment in the new commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0