Commits

Alex Gaynor  committed 52c5ecc

Fix repr(itertools.count(x, 1.0))

  • Participants
  • Parent commits 1b88f6a

Comments (0)

Files changed (2)

File pypy/module/itertools/interp_itertools.py

     def repr_w(self):
         space = self.space
         c = space.str_w(space.repr(self.w_c))
-        if space.eq_w(self.w_step, space.wrap(1)):
+        if (space.isinstance_w(self.w_step, space.w_int) and
+            space.eq_w(self.w_step, space.wrap(1))):
             s = 'count(%s)' % (c,)
         else:
             step = space.str_w(space.repr(self.w_step))

File pypy/module/itertools/test/test_itertools.py

 import py
 from pypy.conftest import gettestobjspace
 
+
 class AppTestItertools: 
     def setup_class(cls):
         cls.space = gettestobjspace(usemodules=['itertools'])
         assert repr(it) == 'count(123)'
         it.next()
         assert repr(it) == 'count(124)'
+        it = itertools.count(12.1, 1.0)
+        assert repr(it) == 'count(12.1, 1.0)'
 
     def test_repeat(self):
         import itertools