diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/arraymodule.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index c03160e..dcb66cf 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -470,8 +470,11 @@ ins1(arrayobject *self, int where, PyObject *v) PyErr_NoMemory(); return -1; } - if (where < 0) - where = 0; + if (where < 0) { + where += self->ob_size; + if (where < 0) + where = 0; + } if (where > self->ob_size) where = self->ob_size; memmove(items + (where+1)*self->ob_descr->itemsize, |