Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sliceobject ssize_t (and index) not completed #43073

Closed
jimjjewett mannequin opened this issue Mar 22, 2006 · 3 comments
Closed

sliceobject ssize_t (and index) not completed #43073

jimjjewett mannequin opened this issue Mar 22, 2006 · 3 comments
Assignees
Labels
extension-modules C modules in the Modules dir

Comments

@jimjjewett
Copy link
Mannequin

jimjjewett mannequin commented Mar 22, 2006

BPO 1456470
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/loewis'
closed_at = <Date 2006-04-03.11:38:29.000>
created_at = <Date 2006-03-22.22:06:13.000>
labels = ['extension-modules']
title = 'sliceobject ssize_t (and index) not completed'
updated_at = <Date 2006-04-03.11:38:29.000>
user = 'https://bugs.python.org/jimjjewett'

bugs.python.org fields:

activity = <Date 2006-04-03.11:38:29.000>
actor = 'loewis'
assignee = 'loewis'
closed = True
closed_date = None
closer = None
components = ['Extension Modules']
creation = <Date 2006-03-22.22:06:13.000>
creator = 'jimjjewett'
dependencies = []
files = []
hgrepos = []
issue_num = 1456470
keywords = []
message_count = 3.0
messages = ['27849', '27850', '27851']
nosy_count = 2.0
nosy_names = ['loewis', 'jimjjewett']
pr_nums = []
priority = 'high'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1456470'
versions = ['Python 2.5']

@jimjjewett
Copy link
Mannequin Author

jimjjewett mannequin commented Mar 22, 2006

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.

@jimjjewett jimjjewett mannequin closed this as completed Mar 22, 2006
@jimjjewett jimjjewett mannequin assigned loewis Mar 22, 2006
@jimjjewett jimjjewett mannequin added the extension-modules C modules in the Modules dir label Mar 22, 2006
@jimjjewett jimjjewett mannequin closed this as completed Mar 22, 2006
@jimjjewett jimjjewett mannequin assigned loewis Mar 22, 2006
@jimjjewett jimjjewett mannequin added the extension-modules C modules in the Modules dir label Mar 22, 2006
@loewis
Copy link
Mannequin

loewis mannequin commented Mar 24, 2006

Logged In: YES
user_id=21627

Would you like to work on a patch?

@loewis
Copy link
Mannequin

loewis mannequin commented Apr 3, 2006

Logged In: YES
user_id=21627

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

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir
Projects
None yet
Development

No branches or pull requests

0 participants