Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/test/test_itertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ def test_count(self):
#check proper internal error handling for large "step' sizes
count(1, maxsize+5); sys.exc_info()

@unittest.expectedFailure # TODO: RUSTPYTHON; 'count(10.5)' != 'count(10.5, 1.0)'
def test_count_with_step(self):
self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
self.assertEqual(lzip('abc',count(start=2,step=3)),
Expand Down
4 changes: 3 additions & 1 deletion crates/vm/src/stdlib/itertools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ mod decl {
let step = &zelf.step;
let mut result = Wtf8Buf::from("count(");
result.push_wtf8(cur_repr.as_wtf8());
if !vm.bool_eq(step, vm.ctx.new_int(1).as_object())? {
let step_is_int_one = step.fast_isinstance(vm.ctx.types.int_type)
&& vm.bool_eq(step, vm.ctx.new_int(1).as_object())?;
if !step_is_int_one {
result.push_str(", ");
result.push_wtf8(step.repr(vm)?.as_wtf8());
}
Expand Down
Loading