diff options
author | Michael W. Hudson <mwh@python.net> | 2002-07-29 14:35:04 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2002-07-29 14:35:04 (GMT) |
commit | 56796f672fb571d80199cf08aa059db9df55257b (patch) | |
tree | 36db817cd703a8c79f44d96f678ed6ba1e399d13 /Objects/listobject.c | |
parent | 085358a3e208b4825dafa829798cfc125f56a2e4 (diff) | |
download | cpython-56796f672fb571d80199cf08aa059db9df55257b.zip cpython-56796f672fb571d80199cf08aa059db9df55257b.tar.gz cpython-56796f672fb571d80199cf08aa059db9df55257b.tar.bz2 |
Fix for
[ 587875 ] crash on deleting extended slice
The array code got simpler, always a good thing!
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 1aa68ed..9a1a6b4 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1780,11 +1780,16 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) understand these for loops */ for (cur = start, i = 0; cur < stop; - cur += step, i++) - { + cur += step, i++) { + int lim = step; + garbage[i] = PyList_GET_ITEM(self, cur); - for (j = 0; j < step; j++) { + if (cur + step >= self->ob_size) { + lim = self->ob_size - cur - 1; + } + + for (j = 0; j < lim; j++) { PyList_SET_ITEM(self, cur + j - i, PyList_GET_ITEM(self, cur + j + 1)); |