mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)
This commit is contained in:
parent
915cd3f069
commit
92709a263e
4 changed files with 24 additions and 2 deletions
|
@ -381,8 +381,6 @@ bytearray_irepeat(PyByteArrayObject *self, Py_ssize_t count)
|
|||
static PyObject *
|
||||
bytearray_getitem(PyByteArrayObject *self, Py_ssize_t i)
|
||||
{
|
||||
if (i < 0)
|
||||
i += Py_SIZE(self);
|
||||
if (i < 0 || i >= Py_SIZE(self)) {
|
||||
PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue