This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Pickling a range iterator with an index of over sizeof(int) stores an invalid index
Type: behavior Stage: resolved
Components: Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chilaxan, lukasz.langa, miss-islington
Priority: normal Keywords: patch

Created on 2021-08-26 16:42 by lukasz.langa, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27938 merged chilaxan, 2021-08-26 16:42
PR 27990 merged miss-islington, 2021-08-27 10:27
PR 27991 merged miss-islington, 2021-08-27 10:27
Messages (4)
msg400360 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-26 16:42
Consider the following:

>>> it = iter(range(2**32 + 2))
>>> for _ in range(2**32):
...   _ = next(it)
>>> it2 = pickle.loads(
...   pickle.dumps(it)
... )
>>> assert next(it) == next(it2)

This assert currently fails because the reduce method for range iterator objects serializes to `int` instead of `long`.

(note that running this example might take tens of minutes on your box)
msg400409 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-27 10:27
New changeset 94a3d2a6329ab7941e93ad2f5bcbb8af2b8b80d2 by chilaxan in branch 'main':
bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938)
https://github.com/python/cpython/commit/94a3d2a6329ab7941e93ad2f5bcbb8af2b8b80d2
msg400411 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-27 10:52
New changeset 02437641d20f58191558ba52570832ef3a30cfef by Miss Islington (bot) in branch '3.9':
bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938) (GH-27991)
https://github.com/python/cpython/commit/02437641d20f58191558ba52570832ef3a30cfef
msg400489 - (view) Author: miss-islington (miss-islington) Date: 2021-08-28 18:09
New changeset cd986e903176d28ed795f65ba14e6fcbf2a65e3d by Miss Islington (bot) in branch '3.10':
bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938)
https://github.com/python/cpython/commit/cd986e903176d28ed795f65ba14e6fcbf2a65e3d
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89181
2021-08-28 18:56:58lukasz.langasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-08-28 18:09:33miss-islingtonsetmessages: + msg400489
2021-08-27 10:52:16lukasz.langasetmessages: + msg400411
2021-08-27 10:27:33miss-islingtonsetpull_requests: + pull_request26437
2021-08-27 10:27:29miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26436
2021-08-27 10:27:22lukasz.langasetmessages: + msg400409
2021-08-26 16:42:57chilaxansetkeywords: + patch
nosy: + chilaxan
pull_requests: + pull_request26424
2021-08-26 16:42:14lukasz.langacreate