Skip to content

Commit 5f8fa32

Browse files
committed
Fix value and overflow error in itertools
1 parent ad08843 commit 5f8fa32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ mod decl {
13741374
PyItertoolsPermutations {
13751375
pool,
13761376
indices: PyRwLock::new((0..n).collect()),
1377-
cycles: PyRwLock::new((0..r).map(|i| n - i).collect()),
1377+
cycles: PyRwLock::new((0..r.min(n)).map(|i| n - i).collect()),
13781378
result: PyRwLock::new(None),
13791379
r: AtomicCell::new(r),
13801380
exhausted: AtomicCell::new(r > n),
@@ -1417,7 +1417,7 @@ mod decl {
14171417
// rotation: indices[i:] = indices[i+1:] + indices[i:i+1]
14181418
let index = indices[i];
14191419
for j in i..n - 1 {
1420-
indices[j] = indices[j + i];
1420+
indices[j] = indices[j + 1];
14211421
}
14221422
indices[n - 1] = index;
14231423
cycles[i] = n - i;

0 commit comments

Comments
 (0)