Fix array.array.insert(), so that it treats negative indices as
being relative to the end of the array, just like list.insert() does.
This closes SF bug #739313.
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 @@
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,