Skip to content

Commit 87b5cce

Browse files
committed
fix: fix code not regenerate
1 parent b954fc7 commit 87b5cce

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Objects/bytearrayobject.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@ bytearray_releasebuffer(PyObject *self, Py_buffer *view)
9090
Py_END_CRITICAL_SECTION();
9191
}
9292

93+
typedef PyObject* (*_ba_bytes_op)(const char *buf, Py_ssize_t len,
94+
PyObject *sub, Py_ssize_t start,
95+
Py_ssize_t end);
96+
97+
static PyObject *
98+
_bytearray_with_buffer(PyByteArrayObject *self, PyObject *sub,
99+
Py_ssize_t start, Py_ssize_t end, _ba_bytes_op op)
100+
{
101+
Py_buffer view;
102+
PyObject *res;
103+
if (PyObject_GetBuffer((PyObject *)self, &view, PyBUF_SIMPLE) != 0) {
104+
return NULL;
105+
}
106+
res = op((const char *)view.buf, view.len, sub, start, end);
107+
PyBuffer_Release(&view);
108+
return res;
109+
}
110+
93111
static int
94112
_canresize(PyByteArrayObject *self)
95113
{
@@ -1228,24 +1246,6 @@ Return the lowest index in B where subsection 'sub' is found, such that 'sub' is
12281246
Return -1 on failure.
12291247
[clinic start generated code]*/
12301248

1231-
typedef PyObject* (*_ba_bytes_op)(const char *buf, Py_ssize_t len,
1232-
PyObject *sub, Py_ssize_t start,
1233-
Py_ssize_t end);
1234-
1235-
static PyObject *
1236-
_bytearray_with_buffer(PyByteArrayObject *self, PyObject *sub,
1237-
Py_ssize_t start, Py_ssize_t end, _ba_bytes_op op)
1238-
{
1239-
Py_buffer view;
1240-
PyObject *res;
1241-
if (PyObject_GetBuffer((PyObject *)self, &view, PyBUF_SIMPLE) != 0) {
1242-
return NULL;
1243-
}
1244-
res = op((const char *)view.buf, view.len, sub, start, end);
1245-
PyBuffer_Release(&view);
1246-
return res;
1247-
}
1248-
12491249
static PyObject *
12501250
bytearray_find_impl(PyByteArrayObject *self, PyObject *sub, Py_ssize_t start,
12511251
Py_ssize_t end)

0 commit comments

Comments
 (0)