[pypy-issue] [issue1554] Regression: getting a small slice of a range list allocates the whole range list

Jan Varho tracker at bugs.pypy.org
Tue Jul 23 13:57:02 CEST 2013


New submission from Jan Varho <jan.varho at gmail.com>:

A change introduced in ad495c3 causes a MemoryError in code that worked fine in 
1.9. The commit undoes an optimization for getslice ona list that uses 
RangeListStrategy. The rationale cited is an overflow, but the test added 
(test_range_getslice_ovf) actually passes with the optimized code from prior to 
the commit.

A simplistic example of code that regressed is something like:
a = range(1, sys.maxint) # the natural numbers
b = a[:N] # do something with the first N

Reverting the getslice method of RangeListStrategy to the version prior to 
ad495c3 and changing test_range_getslice_ovf to assert that l2 is using 
RangeListStrategy seems to work fine.

----------
messages: 5971
nosy: otus, pypy-issue
priority: bug
release: 2.1
status: unread
title: Regression: getting a small slice of a range list allocates the whole range list

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1554>
________________________________________


More information about the pypy-issue mailing list