]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Fix comments for `heapq.siftup_max` (GH-135359) (#136232)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 3 Jul 2025 10:17:10 +0000 (12:17 +0200)
committerGitHub <noreply@github.com>
Thu, 3 Jul 2025 10:17:10 +0000 (10:17 +0000)
Fix comments for `heapq.siftup_max` (GH-135359)
(cherry picked from commit 8f8bdf251a5f79d15ac2b1a6d19860033bf50c79)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
Modules/_heapqmodule.c

index 560fe431fcac992633d03ccd43168acee9865d37..05d01acd77109bc42a85018893c7713af3a5ba9b 100644 (file)
@@ -463,11 +463,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];
@@ -487,7 +487,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];
         FT_ATOMIC_STORE_PTR_RELAXED(arr[childpos], tmp2);