New submission from Philip Jenvey pjen...@underboss.org:
The __length_hint__ optimization was broken a while ago for many iterators due
to a bug introduced in 44c090c74202. It only accepts longs as valid hints, not
ints
This affects 2.6 too (but that's in security-only fix mode), but not 3.x
Philip Jenvey pjen...@underboss.org added the comment:
attached a fix for review
--
keywords: +patch
Added file: http://bugs.python.org/file26383/lengthhint-fix.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15354
Benjamin Peterson benja...@python.org added the comment:
It's probably easier just to use PyNumber_Check.
--
nosy: +benjamin.peterson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15354
___
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 872afada51b0 by Benjamin Peterson in branch '2.7':
allow any number to be returned from __length_hint__ (closes #15354)
http://hg.python.org/cpython/rev/872afada51b0
--
nosy: +python-dev
resolution: - fixed