Lawrence Oluyede <[EMAIL PROTECTED]> wrote:
> What am I missing from the C API?
Found. I edit abstract.c placing some printf here and there and
discovered PyObject_GetItem is always called and in turn it call
PySequence_GetItem so is there my index is translated.
--
Lawrence - http://www.oluyed
Scott David Daniels <[EMAIL PROTECTED]> wrote:
> That is sequence behavior. The convention of -1 for last, -2 for
> second-to-last, ... is done before it gets to your C code. I suspect
> if you don't define a __len__ method, you'd suppress this.
I defined a __len__ method but I get the index "
Lawrence Oluyede wrote:
> While wrapping mmap indexing/sequence emulation I noticed something
> "strange". What's got my attention was the fact that passing -1 from
> Python does not trigger the exception but is changed to the last
> positive and valid index
> I expect this raise IndexEr
While wrapping mmap indexing/sequence emulation I noticed something
"strange".
The source code of this oddity is:
static PyObject *
mmap_item(mmap_object *self, Py_ssize_t i)
{
CHECK_VALID(NULL);
if (i < 0 || (size_t)i >= self->size) {
PyErr_SetString(PyExc_IndexError, "mmap index