[New-bugs-announce] [issue45018] Pickling a range iterator with an index of over sizeof(int) stores an invalid index

Łukasz Langa report at bugs.python.org
Thu Aug 26 12:42:14 EDT 2021


New submission from Łukasz Langa <lukasz at langa.pl>:

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)

----------
messages: 400360
nosy: lukasz.langa
priority: normal
severity: normal
stage: patch review
status: open
title: Pickling a range iterator with an index of over sizeof(int) stores an invalid index
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45018>
_______________________________________


More information about the New-bugs-announce mailing list