[ python-Bugs-1456470 ] sliceobject ssize_t (and index) not completed

SourceForge.net noreply at sourceforge.net
Mon Apr 3 13:38:29 CEST 2006


Bugs item #1456470, was opened at 2006-03-22 23:06
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1456470&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 6
Submitted By: Jim Jewett (jimjjewett)
Assigned to: Martin v. Löwis (loewis)
Summary: sliceobject ssize_t (and index) not completed

Initial Comment:
sliceobject and ceval changed the parameter types of 
slice objects to ssize_t, but the code still requires 
an int (sometimes not even a long); it should use the 
new __index__ slot; at the very least, it should be 
consistent about what it does accept.

In http://svn.python.org/view/python/trunk/Objects/
sliceobject.c?rev=42382&view=markup

[issue 1] function PySlice_GetIndices takes Py_ssize_t 
parameters for (length, start, stop, step)

but then does a PyInt_Check on each of start, stop, 
step.  (An XXX to allow longs was also removed.)  It *
should* use the new __index__ slot.

[issue 2] Later in the same file, function slice_
indices takes a PyObject len parameter, but then uses 
PyInt_AsLong rather than __index__ (or even PyInt_
AsSsize_t) to create Py_ssize_t ilen.

[issue 3]

http://svn.python.org/view/python/trunk/Python/ceval.c?
rev=42382&view=markup

function _PyEval_SliceIndex accepts only ints and 
longs, and longs will be converted to ints with 
clipping.  

It should allow anything with __index__, and clip only 
to ssize_t rather than int.

[issue 4] ISINT still insists on int or long -- I 
thought I saw a fix for this already in the index 
patches.

[issue 5]
apply_slice and assign_slice changed the types of ilow 
and ihigh, but still initializes them to INT_MAX 
rather than ssize_t max.




----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-04-03 13:38

Message:
Logged In: YES 
user_id=21627

I believe these are all fixed as of 43583 (and earlier).

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-03-24 09:33

Message:
Logged In: YES 
user_id=21627

Would you like to work on a patch?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1456470&group_id=5470


More information about the Python-bugs-list mailing list