2 parents fa46ab1 + 5f8fa32 commit fef9bbbCopy full SHA for fef9bbb
1 file changed
vm/src/stdlib/itertools.rs
@@ -1374,7 +1374,7 @@ mod decl {
1374
PyItertoolsPermutations {
1375
pool,
1376
indices: PyRwLock::new((0..n).collect()),
1377
- cycles: PyRwLock::new((0..r).map(|i| n - i).collect()),
+ cycles: PyRwLock::new((0..r.min(n)).map(|i| n - i).collect()),
1378
result: PyRwLock::new(None),
1379
r: AtomicCell::new(r),
1380
exhausted: AtomicCell::new(r > n),
@@ -1417,7 +1417,7 @@ mod decl {
1417
// rotation: indices[i:] = indices[i+1:] + indices[i:i+1]
1418
let index = indices[i];
1419
for j in i..n - 1 {
1420
- indices[j] = indices[j + i];
+ indices[j] = indices[j + 1];
1421
}
1422
indices[n - 1] = index;
1423
cycles[i] = n - i;
0 commit comments