diff options
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 6228e64..047c6ec 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -159,8 +159,11 @@ ins1(PyListObject *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; for (i = self->ob_size; --i >= where; ) |