itertools: fix count() repr to show float step 1.0 (#8261)

Assisted-by: Claude Code:claude-opus-4-8
This commit is contained in:
정지웅 authored and GitHub committed 2026-07-13 14:12:59 +09:00
1 parent 9297e158f3
commit 755a2b7d26
2 files changed
+3 -2

No files matched your search

-1
View File
@@ -538,7 +538,6 @@ class TestBasicOps(unittest.TestCase):
#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)),
+3 -1
View File
@@ -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());
}