10000 gh-111178: fix UBSan failures for `PyBytesObject` (#131603) · python/cpython@a1205ef · GitHub
[go: up one dir, main page]

Skip to content

Commit a1205ef

Browse files
authored
gh-111178: fix UBSan failures for PyBytesObject (#131603)
1 parent 511a844 commit a1205ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/bytesobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,15 +2649,16 @@ bytes_hex_impl(PyBytesObject *self, PyObject *sep, int bytes_per_sep)
26492649
}
26502650

26512651
static PyObject *
2652-
bytes_getnewargs(PyBytesObject *v, PyObject *Py_UNUSED(ignored))
2652+
bytes_getnewargs(PyObject *op, PyObject *Py_UNUSED(dummy))
26532653
{
2654+
PyBytesObject *v = _PyBytes_CAST(op);
26542655
return Py_BuildValue("(y#)", v->ob_sval, Py_SIZE(v));
26552656
}
26562657

26572658

26582659
static PyMethodDef
26592660
bytes_methods[] = {
2660-
{"__getnewargs__", (PyCFunction)bytes_getnewargs, METH_NOARGS},
2661+
{"__getnewargs__", bytes_getnewargs, METH_NOARGS},
26612662
BYTES___BYTES___METHODDEF
26622663
{"capitalize", stringlib_capitalize, METH_NOARGS,
26632664
_Py_capitalize__doc__},

0 commit comments

Comments
 (0)
0