We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd53348 commit 24484fdCopy full SHA for 24484fd
graalpython/lib-graalpython/itertools.py
@@ -246,9 +246,14 @@ def __setstate__(self, state):
246
class count(object):
247
@__graalpython__.builtin_method
248
def __init__(self, start=0, step=1):
249
- if not isinstance(start, (int, float)) or \
250
- not isinstance(step, (int, float)):
251
- raise TypeError('a number is required')
+ valid_start = valid_step = False
+ for o in [start, step]:
+ if not isinstance(o, complex):
252
+ for mm in ["__index__", "__float__", "__int__"]:
253
+ if hasattr(o, mm):
254
+ break
255
+ else:
256
+ raise TypeError("a number is required")
257
self._cnt = start
258
self._step = step
259
0 commit comments