Fix value and overflow error in itertools

This commit is contained in:
clemado1 committed 2020-08-15 18:49:04 +09:00
1 parent ad08843c78
commit 5f8fa320b9
1 file changed
+2 -2
+2 -2
View File
@@ -1374,7 +1374,7 @@ mod decl {
PyItertoolsPermutations {
pool,
indices: PyRwLock::new((0..n).collect()),
cycles: PyRwLock::new((0..r).map(|i| n - i).collect()),
cycles: PyRwLock::new((0..r.min(n)).map(|i| n - i).collect()),
result: PyRwLock::new(None),
r: AtomicCell::new(r),
exhausted: AtomicCell::new(r > n),
@@ -1417,7 +1417,7 @@ mod decl {
// rotation: indices[i:] = indices[i+1:] + indices[i:i+1]
let index = indices[i];
for j in i..n - 1 {
indices[j] = indices[j + i];
indices[j] = indices[j + 1];
}
indices[n - 1] = index;
cycles[i] = n - i;