Show More
@@ -158,6 +158,11 b' static PyObject *index_get(indexObject *' | |||||
158 | Py_ssize_t length = index_length(self); |
|
158 | Py_ssize_t length = index_length(self); | |
159 | PyObject *entry; |
|
159 | PyObject *entry; | |
160 |
|
160 | |||
|
161 | if (pos == -1 || pos == length - 1) { | |||
|
162 | Py_INCREF(nullentry); | |||
|
163 | return nullentry; | |||
|
164 | } | |||
|
165 | ||||
161 | if (pos < 0) |
|
166 | if (pos < 0) | |
162 | pos += length; |
|
167 | pos += length; | |
163 |
|
168 | |||
@@ -166,11 +171,6 b' static PyObject *index_get(indexObject *' | |||||
166 | return NULL; |
|
171 | return NULL; | |
167 | } |
|
172 | } | |
168 |
|
173 | |||
169 | if (pos == length - 1) { |
|
|||
170 | Py_INCREF(nullentry); |
|
|||
171 | return nullentry; |
|
|||
172 | } |
|
|||
173 |
|
||||
174 | if (pos >= self->length - 1) { |
|
174 | if (pos >= self->length - 1) { | |
175 | PyObject *obj; |
|
175 | PyObject *obj; | |
176 | obj = PyList_GET_ITEM(self->added, pos - self->length + 1); |
|
176 | obj = PyList_GET_ITEM(self->added, pos - self->length + 1); |
@@ -55,9 +55,9 b' class BaseIndexObject(object):' | |||||
55 | return i |
|
55 | return i | |
56 |
|
56 | |||
57 | def __getitem__(self, i): |
|
57 | def __getitem__(self, i): | |
|
58 | if i == -1 or i == len(self) - 1: | |||
|
59 | return (0, 0, 0, -1, -1, -1, -1, nullid) | |||
58 | i = self._fix_index(i) |
|
60 | i = self._fix_index(i) | |
59 | if i == len(self) - 1: |
|
|||
60 | return (0, 0, 0, -1, -1, -1, -1, nullid) |
|
|||
61 | if i >= self._lgt: |
|
61 | if i >= self._lgt: | |
62 | return self._extra[i - self._lgt] |
|
62 | return self._extra[i - self._lgt] | |
63 | index = self._calculate_index(i) |
|
63 | index = self._calculate_index(i) |
General Comments 0
You need to be logged in to leave comments.
Login now