[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset b23f963a7b45 by Serhiy Storchaka in branch '3.5': Issue #28019: itertools.count() no longer rounds non-integer step in range https://hg.python.org/cpython/rev/b23f963a7b45 New changeset 74667320778e by Serhiy Storchaka in branch '2.7': Issue

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: rhettinger -> serhiy.storchaka ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PyLong_AsLong() not just converts Python integer to C long, but it also converts Python float to Python integer (with the lost of the fractional part). We need to check that the value is Python integer. Here is a patch that fixes this issue and few other

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Marcos Dione
Changes by Marcos Dione : -- versions: +Python 3.3, Python 3.4 ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread SilentGhost
Changes by SilentGhost : -- stage: patch review -> commit review ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Marcos Dione
Marcos Dione added the comment: New patch following comments from SilentGhost. -- Added file: http://bugs.python.org/file44467/fix_28019.diff ___ Python tracker

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Facundo Batista
Facundo Batista added the comment: I think the fix nails it; all the problem was that the "fast" mode was wrongly detected, and all the problems (counting badly, or a bad repr, etc) is a problem after setting cnt into PY_SSIZE_T_MAX. IIUC there is nothing special to do when step=1.0, as later

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread SilentGhost
Changes by SilentGhost : -- stage: -> patch review versions: -Python 3.3, Python 3.4 ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Marcos Dione
Changes by Marcos Dione : -- versions: +Python 3.3, Python 3.4 ___ Python tracker ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Marcos Dione
Marcos Dione added the comment: Here's a first approach on fixing this bug. I'm not sure how to handle the case where step=1.0. -- keywords: +patch Added file: http://bugs.python.org/file44466/fix_28019.diff ___ Python tracker

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Facundo Batista
Changes by Facundo Batista : -- versions: +Python 3.5 ___ Python tracker ___ ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +rhettinger ___ Python tracker ___ ___

[issue28019] itertools.count() falls back to fast (integer) mode when step rounds to 1

2016-09-08 Thread Marcos Dione
New submission from Marcos Dione: If the `step` parameter for `itertools.count()` rounds to 1 (f.i., 1.1, 1.437643, 1.9), then it fallsback to fast (integer) mode and increases the counter by 1. Here's an example: Python 3.6.0a4+ (default:ddc95a9bc2e0+, Sep 8 2016, 14:46:19) >>> import