Skip to content
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Next Next commit
fix: fix code not regenerate
  • Loading branch information
fatelei committed Dec 12, 2025
commit 87b5ccec76e5a67a89a03bce9847b0f319d1e6ed
36 changes: 18 additions & 18 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ bytearray_releasebuffer(PyObject *self, Py_buffer *view)
Py_END_CRITICAL_SECTION();
}

typedef PyObject* (*_ba_bytes_op)(const char *buf, Py_ssize_t len,
PyObject *sub, Py_ssize_t start,
Py_ssize_t end);

static PyObject *
_bytearray_with_buffer(PyByteArrayObject *self, PyObject *sub,
Py_ssize_t start, Py_ssize_t end, _ba_bytes_op op)
{
Py_buffer view;
PyObject *res;
if (PyObject_GetBuffer((PyObject *)self, &view, PyBUF_SIMPLE) != 0) {
return NULL;
}
res = op((const char *)view.buf, view.len, sub, start, end);
PyBuffer_Release(&view);
return res;
}

static int
_canresize(PyByteArrayObject *self)
{
Expand Down Expand Up @@ -1228,24 +1246,6 @@ Return the lowest index in B where subsection 'sub' is found, such that 'sub' is
Return -1 on failure.
[clinic start generated code]*/

typedef PyObject* (*_ba_bytes_op)(const char *buf, Py_ssize_t len,
PyObject *sub, Py_ssize_t start,
Py_ssize_t end);

static PyObject *
_bytearray_with_buffer(PyByteArrayObject *self, PyObject *sub,
Py_ssize_t start, Py_ssize_t end, _ba_bytes_op op)
{
Py_buffer view;
PyObject *res;
if (PyObject_GetBuffer((PyObject *)self, &view, PyBUF_SIMPLE) != 0) {
return NULL;
}
res = op((const char *)view.buf, view.len, sub, start, end);
PyBuffer_Release(&view);
return res;
}

static PyObject *
bytearray_find_impl(PyByteArrayObject *self, PyObject *sub, Py_ssize_t start,
Py_ssize_t end)
Expand Down
Loading