diff -r 2344e8b7a8aa Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c Sun Jun 21 17:12:16 2015 +0300 +++ b/Objects/bytearrayobject.c Tue Jun 23 10:13:14 2015 +0200 @@ -2527,8 +2527,8 @@ return NULL; } if (index < 0) - index += Py_SIZE(self); - if (index < 0 || index >= Py_SIZE(self)) { + index += n; + if (index < 0 || index >= n) { PyErr_SetString(PyExc_IndexError, "pop index out of range"); return NULL; } @@ -2537,7 +2537,7 @@ buf = PyByteArray_AS_STRING(self); value = buf[index]; - memmove(buf + index, buf + index + 1, n - index); + memmove(buf + index, buf + index + 1, n - index - 1); if (PyByteArray_Resize((PyObject *)self, n - 1) < 0) return NULL; @@ -2573,7 +2573,7 @@ if (!_canresize(self)) return NULL; - memmove(buf + where, buf + where + 1, n - where); + memmove(buf + where, buf + where + 1, n - where - 1); if (PyByteArray_Resize((PyObject *)self, n - 1) < 0) return NULL;