##// END OF EJS Templates
parsers: reduce raw_length when truncating...
Bryan O'Sullivan -
r16784:12a852c7 default
parent child Browse files
Show More
@@ -930,6 +930,7 b' static int index_slice_del(indexObject *'
930 {
930 {
931 Py_ssize_t start, stop, step, slicelength;
931 Py_ssize_t start, stop, step, slicelength;
932 Py_ssize_t length = index_length(self);
932 Py_ssize_t length = index_length(self);
933 int ret = 0;
933
934
934 if (PySlice_GetIndicesEx((PySliceObject*)item, length,
935 if (PySlice_GetIndicesEx((PySliceObject*)item, length,
935 &start, &stop, &step, &slicelength) < 0)
936 &start, &stop, &step, &slicelength) < 0)
@@ -975,7 +976,9 b' static int index_slice_del(indexObject *'
975 self->ntrev = (int)start;
976 self->ntrev = (int)start;
976 }
977 }
977 self->length = start + 1;
978 self->length = start + 1;
978 return 0;
979 if (start < self->raw_length)
980 self->raw_length = start;
981 goto done;
979 }
982 }
980
983
981 if (self->nt) {
984 if (self->nt) {
@@ -983,10 +986,11 b' static int index_slice_del(indexObject *'
983 if (self->ntrev > start)
986 if (self->ntrev > start)
984 self->ntrev = (int)start;
987 self->ntrev = (int)start;
985 }
988 }
986 return self->added
989 if (self->added)
987 ? PyList_SetSlice(self->added, start - self->length + 1,
990 ret = PyList_SetSlice(self->added, start - self->length + 1,
988 PyList_GET_SIZE(self->added), NULL)
991 PyList_GET_SIZE(self->added), NULL);
989 : 0;
992 done:
993 return ret;
990 }
994 }
991
995
992 /*
996 /*
General Comments 0
You need to be logged in to leave comments. Login now