https://github.com/python/cpython/commit/a1205ef524ad5aa97af08ef77753271a84936fba commit: a1205ef524ad5aa97af08ef77753271a84936fba branch: main author: Bénédikt Tran <10796600+picn...@users.noreply.github.com> committer: picnixz <10796600+picn...@users.noreply.github.com> date: 2025-03-24T11:02:09+01:00 summary:
gh-111178: fix UBSan failures for `PyBytesObject` (#131603) files: M Objects/bytesobject.c diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index bdb389eb25823e..31ba89ffb18379 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2649,15 +2649,16 @@ bytes_hex_impl(PyBytesObject *self, PyObject *sep, int bytes_per_sep) } static PyObject * -bytes_getnewargs(PyBytesObject *v, PyObject *Py_UNUSED(ignored)) +bytes_getnewargs(PyObject *op, PyObject *Py_UNUSED(dummy)) { + PyBytesObject *v = _PyBytes_CAST(op); return Py_BuildValue("(y#)", v->ob_sval, Py_SIZE(v)); } static PyMethodDef bytes_methods[] = { - {"__getnewargs__", (PyCFunction)bytes_getnewargs, METH_NOARGS}, + {"__getnewargs__", bytes_getnewargs, METH_NOARGS}, BYTES___BYTES___METHODDEF {"capitalize", stringlib_capitalize, METH_NOARGS, _Py_capitalize__doc__}, _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com