Skip to content

Fix comments for heapq.siftup_max() #135359

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Modules/_heapqmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,11 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
return -1;
}

/* Bubble up the smaller child until hitting a leaf. */
/* Bubble up the larger child until hitting a leaf. */
arr = _PyList_ITEMS(heap);
limit = endpos >> 1; /* smallest pos that has no child */
while (pos < limit) {
/* Set childpos to index of smaller child. */
/* Set childpos to index of larger child. */
childpos = 2*pos + 1; /* leftmost child position */
if (childpos + 1 < endpos) {
PyObject* a = arr[childpos + 1];
Expand All @@ -483,7 +483,7 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
return -1;
}
}
/* Move the smaller child up. */
/* Move the larger child up. */
tmp1 = arr[childpos];
tmp2 = arr[pos];
arr[childpos] = tmp2;
Expand Down
Loading