mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-47116: use _PyLong_FromUnsignedChar instead of PyLong_FromLong (GH-32110)
This commit is contained in:
parent
e8e737bcf6
commit
c23ddf5ec2
2 changed files with 5 additions and 5 deletions
|
@ -396,7 +396,7 @@ bytearray_getitem(PyByteArrayObject *self, Py_ssize_t i)
|
|||
PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyLong_FromLong((unsigned char)(PyByteArray_AS_STRING(self)[i]));
|
||||
return _PyLong_FromUnsignedChar((unsigned char)(self->ob_start[i]));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -415,7 +415,7 @@ bytearray_subscript(PyByteArrayObject *self, PyObject *index)
|
|||
PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyLong_FromLong((unsigned char)(PyByteArray_AS_STRING(self)[i]));
|
||||
return _PyLong_FromUnsignedChar((unsigned char)(self->ob_start[i]));
|
||||
}
|
||||
else if (PySlice_Check(index)) {
|
||||
Py_ssize_t start, stop, step, slicelength, i;
|
||||
|
@ -1841,7 +1841,7 @@ bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index)
|
|||
if (PyByteArray_Resize((PyObject *)self, n - 1) < 0)
|
||||
return NULL;
|
||||
|
||||
return PyLong_FromLong((unsigned char)value);
|
||||
return _PyLong_FromUnsignedChar((unsigned char)value);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue