Author teoliphant
Recipients
Date 2006-08-11.10:51:34
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This is a patch that builds off of Nick Coghlan's work
to fix the __index__() clipping problem.  

It defines 3 New C-API calls (1 is a macro):

int PyIndex_Check(obj) -- does this object have nb_index

PyObject* PyNumber_Index(obj) -- return nb_index(obj)
if possible

Py_ssize_t PyNumber_AsSsize_t(obj, err) -- return obj
as Py_ssize_t by frist going through nb_index(obj)
which returns an integer or long integer.  If err is
NULL, then clip on Overflow, otherwise raise err on
Overflow encountered when trying to fit the result of
nb_index into a Py_ssize_t slot. 

With these three C-API calls, I was able to fix all the
problems that have been identified and simplify several
pieces of code. 



History
Date User Action Args
2007-08-23 15:54:02adminlinkissue1538606 messages
2007-08-23 15:54:02admincreate