summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-23 19:35:39 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-23 19:35:39 (GMT)
commit05380645546208b67df8a9ac7ee509dffb1f77e7 (patch)
tree76307d3b0c8cd95a5c28aa7d3078fbe58e760a3e
parentde6e9d615ddada40fb0ee4e005777eb73a147058 (diff)
downloadcpython-05380645546208b67df8a9ac7ee509dffb1f77e7.zip
cpython-05380645546208b67df8a9ac7ee509dffb1f77e7.tar.gz
cpython-05380645546208b67df8a9ac7ee509dffb1f77e7.tar.bz2
reorder and save a comparison
-rw-r--r--Objects/listobject.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 0dab784..88478f3 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1934,17 +1934,17 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
}
}
- /* Reverse sort stability achieved by initially reversing the list,
- applying a stable forward sort, then reversing the final result. */
- if (reverse && saved_ob_size > 1)
- reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
-
merge_init(&ms);
nremaining = saved_ob_size;
if (nremaining < 2)
goto succeed;
+ /* Reverse sort stability achieved by initially reversing the list,
+ applying a stable forward sort, then reversing the final result. */
+ if (reverse)
+ reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
+
/* March over the array once, left to right, finding natural runs,
* and extending short natural runs to minrun elements.
*/