[issue15354] _PyObject_LengthHint only accepts longs

2012-07-14 Thread Philip Jenvey
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

[issue15354] _PyObject_LengthHint only accepts longs

2012-07-14 Thread Philip Jenvey
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

[issue15354] _PyObject_LengthHint only accepts longs

2012-07-14 Thread Benjamin Peterson
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 ___

[issue15354] _PyObject_LengthHint only accepts longs

2012-07-14 Thread Roundup Robot
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