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

Skip to content

Commit 0538064

Browse files
committed
reorder and save a comparison
1 parent de6e9d6 commit 0538064

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Objects/listobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,17 +1934,17 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
19341934
}
19351935
}
19361936

1937-
/* Reverse sort stability achieved by initially reversing the list,
1938-
applying a stable forward sort, then reversing the final result. */
1939-
if (reverse && saved_ob_size > 1)
1940-
reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
1941-
19421937
merge_init(&ms);
19431938

19441939
nremaining = saved_ob_size;
19451940
if (nremaining < 2)
19461941
goto succeed;
19471942

1943+
/* Reverse sort stability achieved by initially reversing the list,
1944+
applying a stable forward sort, then reversing the final result. */
1945+
if (reverse)
1946+
reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
1947+
19481948
/* March over the array once, left to right, finding natural runs,
19491949
* and extending short natural runs to minrun elements.
19501950
*/

0 commit comments

Comments
 (0)