homepage

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 jimjjewett
Recipients
Date 2006年03月22日.22:06:13
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007年08月23日 14:38:40adminlinkissue1456470 messages
2007年08月23日 14:38:40admincreate

AltStyle によって変換されたページ (->オリジナル) /