We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad08843 commit 5f8fa32Copy full SHA for 5f8fa32
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