mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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)
This commit is contained in:
parent
2f32fbba34
commit
044b9dc1d7
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue