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.

classification
Title: sliceobject ssize_t (and index) not completed
Type: Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: jimjjewett, loewis
Priority: high Keywords:

Created on 2006-03-22 22:06 by jimjjewett, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg27849 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-03-22 22:06
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.


msg27850 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-03-24 08:33
Logged In: YES 
user_id=21627

Would you like to work on a patch?
msg27851 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-03 11:38
Logged In: YES 
user_id=21627

I believe these are all fixed as of 43583 (and earlier).
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43073
2006-03-22 22:06:13jimjjewettcreate