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.

Author bmiller
Recipients benjamin.peterson, bmiller, loewis
Date 2008-04-11.02:04:22
SpamBayes Score 0.037966847
Marked as misclassified No
Message-id <1207879466.62.0.9144401122.issue2610@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for all of the help.  Using range_item certainly simplified my 
job.  Although I more than made up for it with all of the decref and 
error checking calls.

One side effect of using range_item is that str(range(...)) is now 
subject to the same errors as indexing into really big range:
for example: 
x = range(1000000000000000000)
x[1]
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C ssize_t

In a world where ints and long ints have been unified the existence of 
this error seems like a bug.

I think the right thing would be to fix range_item and range_length so 
they do not use Py_ssize_t for the length of the range.  But I may be in 
over my head on that guess.

I also discovered that range_item does not work with negative indices.

I have been poking around the tests and added some simple tests to the 
test_range.py class as well.  I assume I should submit a patch for that 
as well?

I have attached a new patch for rangeobject.c

Brad
History
Date User Action Args
2008-04-11 02:04:27bmillersetspambayes_score: 0.0379668 -> 0.037966847
recipients: + bmiller, loewis, benjamin.peterson
2008-04-11 02:04:26bmillersetspambayes_score: 0.0379668 -> 0.0379668
messageid: <1207879466.62.0.9144401122.issue2610@psf.upfronthosting.co.za>
2008-04-11 02:04:25bmillerlinkissue2610 messages
2008-04-11 02:04:23bmillercreate