New submission from Łukasz Langa <luk...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45018>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to