[Python-Dev] Re: [snake-farm] test test_slice failed -- [9, 7, 5, 3, 1] == [0]

Neal Norwitz neal@metaslash.com
Wed, 06 Nov 2002 08:56:54 -0500

On Tue, Nov 05, 2002 at 09:39:18PM -0500, Guido van Rossum wrote:
> > PySlice_GetIndicesEx() was added in 2.3.
> You meant "must be added" right?

No, this was an API Michael added when doing the extended slicing, AFAIK.

> > Otherwise, we are stuck with slices only being able to support
> > 32 bits even on 64 bit architectures.
> But *everything* having to do with sequences only supports 32 bits:
> ob_size, PySequence_Length() the arguments to PySequence_GetItem(),
> etc.
> Unless you want to fix all those (breaking backwards compatibility),
> I'm not sure why you'd want to fix PySlice_GetIndices()...

You're right.  This gets me thinking about starting to remove
the 32 bit limitation...

I looked at how hard it would be to support 64 bit sequences.

If we did this, 64 bit users would be able to use long sequences at
the expense of backwards compatibility.  Also, we would need something
like Py_seq_len, use a configure option, and all the ob_size,
arguments etc. would have to use the new type name.

I did a grep for int, there were a ton.  But it looks like
those used for sequence lengths were much fewer.

I suppose this change could be accomplished in stages.  

        Step 1, typedef int Py_seq_len; for all platforms.
        Step 2, start using it for the proper APIs in the header files.
        Step 3, change the C files.
        Repeat steps 2 & 3 until done.

I'm not volunteering, of course. :-) I don't need this and have no
system to use for testing.  So this is all academic at best.