diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -274,29 +274,16 @@ PyByteArray_Concat(PyObject *a, PyObject done: if (va.len != -1) PyBuffer_Release(&va); if (vb.len != -1) PyBuffer_Release(&vb); return (PyObject *)result; } -static PyObject * -bytearray_format(PyByteArrayObject *self, PyObject *args) -{ - if (self == NULL || !PyByteArray_Check(self)) { - PyErr_BadInternalCall(); - return NULL; - } - - return _PyBytes_FormatEx(PyByteArray_AS_STRING(self), - PyByteArray_GET_SIZE(self), - args, 1); -} - /* Functions stuffed into the type object */ static Py_ssize_t bytearray_length(PyByteArrayObject *self) { return Py_SIZE(self); } @@ -3009,17 +2996,17 @@ bytearray_methods[] = { {NULL} }; static PyObject * bytearray_mod(PyObject *v, PyObject *w) { if (!PyByteArray_Check(v)) Py_RETURN_NOTIMPLEMENTED; - return bytearray_format((PyByteArrayObject *)v, w); + return _PyBytes_FormatEx(PyByteArray_AS_STRING(v), PyByteArray_GET_SIZE(v), w, 1); } static PyNumberMethods bytearray_as_number = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ bytearray_mod, /*nb_remainder*/ };