Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix UBSan failures for PyByteArrayObject
  • Loading branch information
picnixz committed Dec 24, 2024
commit e84fd505cdb3c9acf3f5615a33aee4f9a8f959b8
5 changes: 3 additions & 2 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,8 +2113,9 @@ PyDoc_STRVAR(alloc_doc,
Return the number of bytes actually allocated.");

static PyObject *
bytearray_alloc(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
bytearray_alloc(PyObject *op, PyObject *Py_UNUSED(ignored))
{
PyByteArrayObject *self = _PyByteArray_CAST(op);
return PyLong_FromSsize_t(self->ob_alloc);
}

Expand Down Expand Up @@ -2313,7 +2314,7 @@ static PyBufferProcs bytearray_as_buffer = {
};

static PyMethodDef bytearray_methods[] = {
{"__alloc__", (PyCFunction)bytearray_alloc, METH_NOARGS, alloc_doc},
{"__alloc__", bytearray_alloc, METH_NOARGS, alloc_doc},
BYTEARRAY_REDUCE_METHODDEF
BYTEARRAY_REDUCE_EX_METHODDEF
BYTEARRAY_SIZEOF_METHODDEF
Expand Down