Commit 1eb9a9a6 authored by Boxiang Sun's avatar Boxiang Sun

get slice copy before calculate the posistion

parent b8e204b7
......@@ -490,6 +490,9 @@ static inline void listSetitemSliceInt64(BoxedList* self, i64 start, i64 stop, i
v_size = 0;
v_elts = NULL;
} else {
if (self == v) // handle self assignment by creating a copy
v = _listSlice(self, 0, self->size, 1, self->size);
v_as_seq = RootedBox(PySequence_Fast(v, "can only assign an iterable"));
if (v_as_seq == NULL)
throwCAPIException();
......@@ -502,9 +505,6 @@ static inline void listSetitemSliceInt64(BoxedList* self, i64 start, i64 stop, i
v_elts = NULL;
}
if (self == v) // handle self assignment by creating a copy
v = _listSlice(self, 0, self->size, 1, self->size);
int delts = v_size - (stop - start);
int remaining_elts = self->size - stop;
self->ensure(delts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment