summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-25 17:50:03 +0000
committerGuido van Rossum <guido@python.org>1998-02-25 17:50:03 +0000
commitd2ea0561be307f4513f12562cbfa9256f6e23ad8 (patch)
tree2082762fa7bfad2fcde9901b9b8f1ad7ee6a328d /Objects
parentb1b743b7ee40d39f4db98887e0ebcda7e4aa95be (diff)
downloadcpython-d2ea0561be307f4513f12562cbfa9256f6e23ad8.tar.gz
Add back some safeguards on the index elements that were lost in the
last patch. Dave Ascher found a case that dumps core without these: def myComparison(x,y): return cmp(x%3,y%7) z = range(12) z.sort(myComparison)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index a5bd038a3f..8bec8afc70 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -719,7 +719,7 @@ quicksort(array, size, compare)
r = hi-2;
for (;;) {
/* Move left index to element > pivot */
- for (;;) {
+ while (l < hi) {
k = docompare(*l, pivot, compare);
if (k == CMPERROR)
return -1;
@@ -728,7 +728,7 @@ quicksort(array, size, compare)
l++;
}
/* Move right index to element < pivot */
- for (;;) {
+ while (r >= lo) {
k = docompare(pivot, *r, compare);
if (k == CMPERROR)
return -1;