[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset bff269ee7288 by Mark Dickinson in branch '2.7': Issues #16029, #16030: Fix pickling and repr of large xranges. http://hg.python.org/cpython/rev/bff269ee7288 -- nosy: +python-dev ___ Python tracker

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-28 Thread Mark Dickinson
Mark Dickinson added the comment: Now fixed. Thanks for the report! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16029 ___

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-25 Thread Mark Dickinson
Mark Dickinson added the comment: Updated patch, which also fixes issue 16030. It needs more tests. -- Added file: http://bugs.python.org/file27289/xrange_reduce_repr.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16029

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-25 Thread Mark Dickinson
Mark Dickinson added the comment: Patch with tests. -- components: +Interpreter Core -Library (Lib) stage: needs patch - commit review Added file: http://bugs.python.org/file27295/xrange_reduce_repr_2.patch ___ Python tracker rep...@bugs.python.org

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-25 Thread Mark Dickinson
Mark Dickinson added the comment: Whoops; there's no need to iterate over pickle protocols in test_repr. New patch. -- Added file: http://bugs.python.org/file27296/xrange_reduce_repr_3.patch ___ Python tracker rep...@bugs.python.org

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-25 Thread Mark Dickinson
Mark Dickinson added the comment: Updated patch: rename range_stop, as suggested in Rietveld review. -- Added file: http://bugs.python.org/file27302/xrange_reduce_repr_4.patch ___ Python tracker rep...@bugs.python.org

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread akira
New submission from akira: import sys from pickle import dumps, loads r = xrange(sys.maxsize) len(r) == sys.maxsize True pr = loads(dumps(r)) len(pr) == len(r) False pr xrange(0) r xrange(9223372036854775807) It breaks multiprocessing module:

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Mark Dickinson added the comment: The bug is (not surprisingly) in range_reduce in Objects/rangeobject.c, where return Py_BuildValue((O(iii)), Py_TYPE(r), should be return Py_BuildValue((O(lll)), Py_TYPE(r), But in writing tests for this bug, I fell over another one: import sys

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Mark Dickinson added the comment: Here's the fix. There's a commented out test, which fails because of the second xrange bug (or something closely related to it). -- keywords: +patch Added file: http://bugs.python.org/file27282/issue16029.patch ___

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Mark Dickinson added the comment: Removing 2.6: this isn't a security issue. -- stage: - patch review versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16029 ___

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16029 ___ ___

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Mark Dickinson added the comment: Okay, the xrange stop for both its pickle and its repr is computed as: r-start + r-len * r-step If this overflows, it gives a bad value. It would suffice to replace it with sys.maxint or -sys.maxint - 1 on overflow. I'll look at this shortly. --

[issue16029] pickle.dumps(xrange(sys.maxsize)) produces xrange(0)

2012-09-24 Thread Mark Dickinson
Mark Dickinson added the comment: Opened issue #16030 for the repr issue. The patch for this issue still lacks a fix for the stop value. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16029