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 gvanrossum
Recipients
Date 2006-03-06.19:36:41
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=6380

I'm sorry, but this still doesn't do what I think __index__
ought to do for a long: it ought to return self unchanged,
even if it's out of range for ssize_t.  IOW I want
(2**100).__index__() to return 2**100, not 2**31-1.  The
clipping should be done only on the conversion to ssize_t in
nb_index.

I reviewed the code that was new since my last patch.  Apart
from the above objection, it all looks good except:

- You seem to have lost the diffs for test_index.py; if you
do "svn add Lib/test/test_index.py" it will show up.

- Style nit: you don't have to use \ to split C lines
*unless* it's a multi-line CPP macro definition.

- Another style nit: try to put spaces around the ==
operator (and other comparisons).  i==-1 looks like
line-noise to me; i == -1 looks much better.

- _PyLong_AsSize_t() and long_index check for
PyErr_Occurred() after calling _long_as_ssize_t(); they
should really cal PyErr_Clear() before calling that, since
otherwise they can be fooled by pre-existing errors. 
(Clearing pre-existing errors is *also* bad, but they are
really a symptom of something bad already going on; the
general rule is to pre-clear errors *if* you're going to
check for PyErr_Occurred() instead of checking for error
return values (NULL or -1).
History
Date User Action Args
2007-08-23 15:46:00adminlinkissue1436368 messages
2007-08-23 15:46:00admincreate