Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,37 @@ def __index__(self):
self.assertEqual(instance.ba[0], ord("?"), "Assigned bytearray not altered")
self.assertEqual(instance.new_ba, bytearray(0x180), "Wrong object altered")

def test_search_methods_reentrancy_raises_buffererror(self):
# gh-142560: Raise BufferError if buffer mutates during search arg conversion.
class Evil:
def __init__(self, ba):
self.ba = ba
def __buffer__(self, flags):
self.ba.clear()
return memoryview(self.ba)
def __release_buffer__(self, view: memoryview) -> None:
view.release()
def __index__(self):
self.ba.clear()
return ord("A")

def make_case():
ba = bytearray(b"A")
return ba, Evil(ba)

for name in ("find", "count", "index", "rindex", "rfind"):
ba, evil = make_case()
with self.subTest(name):
with self.assertRaises(BufferError):
getattr(ba, name)(evil)

ba, evil = make_case()
with self.assertRaises(BufferError):
evil in ba
with self.assertRaises(BufferError):
ba.split(evil)
with self.assertRaises(BufferError):
ba.rsplit(evil)

class AssortedBytesTest(unittest.TestCase):
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix use-after-free in :class:`bytearray` search-like methods (:meth:`~bytearray.find`, :meth:`~bytearray.count`, :meth:`~bytearray.index`, :meth:`~bytearray.rindex`, and :meth:`~bytearray.rfind`) by marking the storage as exported which causes reallocation attempts to raise :exc:`BufferError`. For :func:`~operator.contains`, :meth:`~bytearray.split`, and :meth:`~bytearray.rsplit` the :ref:`buffer protocol <bufferobjects>` is used for this.
114 changes: 72 additions & 42 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@
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, _ba_bytes_op op, PyObject *sub,
Py_ssize_t start, Py_ssize_t end)
{
PyObject *res;

_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self);

/* Increase exports to prevent bytearray storage from changing during op. */
self->ob_exports++;
res = op(PyByteArray_AS_STRING(self), Py_SIZE(self), sub, start, end);
self->ob_exports--;
return res;
}

static int
_canresize(PyByteArrayObject *self)
{
Expand Down Expand Up @@ -1248,8 +1267,7 @@
Py_ssize_t end)
/*[clinic end generated code: output=413e1cab2ae87da0 input=df3aa94840d893a7]*/
{
return _Py_bytes_find(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
sub, start, end);
return _bytearray_with_buffer(self, _Py_bytes_find, sub, start, end);
}

/*[clinic input]
Expand All @@ -1265,8 +1283,7 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=a21ee2692e4f1233 input=e8fcdca8272857e0]*/
{
return _Py_bytes_count(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
sub, start, end);
return _bytearray_with_buffer(self, _Py_bytes_count, sub, start, end);
}

/*[clinic input]
Expand Down Expand Up @@ -1314,8 +1331,7 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=067a1e78efc672a7 input=c37f177cfee19fe4]*/
{
return _Py_bytes_index(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
sub, start, end);
return _bytearray_with_buffer(self, _Py_bytes_index, sub, start, end);
}

/*[clinic input]
Expand All @@ -1333,8 +1349,7 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=51bf886f932b283c input=1265b11c437d2750]*/
{
return _Py_bytes_rfind(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
sub, start, end);
return _bytearray_with_buffer(self, _Py_bytes_rfind, sub, start, end);
}

/*[clinic input]
Expand All @@ -1352,18 +1367,20 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=38e1cf66bafb08b9 input=7d198b3d6b0a62ce]*/
{
return _Py_bytes_rindex(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
sub, start, end);
return _bytearray_with_buffer(self, _Py_bytes_rindex, sub, start, end);
}

static int
bytearray_contains(PyObject *self, PyObject *arg)
{
int ret;
int ret = -1;
Py_BEGIN_CRITICAL_SECTION(self);
ret = _Py_bytes_contains(PyByteArray_AS_STRING(self),
PyByteArrayObject *ba = _PyByteArray_CAST(self);
ba->ob_exports++;
ret = _Py_bytes_contains(PyByteArray_AS_STRING(ba),
PyByteArray_GET_SIZE(self),
arg);
ba->ob_exports--;
Py_END_CRITICAL_SECTION();
return ret;
}
Expand All @@ -1390,8 +1407,7 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=a3d9b6d44d3662a6 input=93f9ffee684f109a]*/
{
return _Py_bytes_startswith(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
subobj, start, end);
return _bytearray_with_buffer(self, _Py_bytes_startswith, subobj, start, end);
}

/*[clinic input]
Expand All @@ -1416,8 +1432,7 @@
Py_ssize_t start, Py_ssize_t end)
/*[clinic end generated code: output=e75ea8c227954caa input=d158b030a11d0b06]*/
{
return _Py_bytes_endswith(PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self),
subobj, start, end);
return _bytearray_with_buffer(self, _Py_bytes_endswith, subobj, start, end);
}

/*[clinic input]
Expand Down Expand Up @@ -1781,27 +1796,36 @@
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
Py_ssize_t maxsplit)
/*[clinic end generated code: output=833e2cf385d9a04d input=dd9f6e2910cc3a34]*/

static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit)

Check failure on line 1801 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

redefinition of formal parameter 'bytearray_split_impl' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1801 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

redefinition of formal parameter 'bytearray_split_impl' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1801 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

redefinition of formal parameter 'bytearray_split_impl' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1801 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

redefinition of formal parameter 'bytearray_split_impl' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
{

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

syntax error: missing ';' before '{' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

syntax error: missing ';' before '{' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

syntax error: missing ';' before '{' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

syntax error: missing ';' before '{' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1802 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Py_ssize_t len = PyByteArray_GET_SIZE(self), n;
const char *s = PyByteArray_AS_STRING(self), *sub;
PyObject *list;
Py_buffer vsub;
PyObject *list = NULL;
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED((PyObject *)self);

self->ob_exports++;
const char *sbuf = PyByteArray_AS_STRING(self);
Py_ssize_t slen = PyByteArray_GET_SIZE((PyObject *)self);

if (maxsplit < 0)
maxsplit = PY_SSIZE_T_MAX;

if (sep == Py_None)
return stringlib_split_whitespace((PyObject*) self, s, len, maxsplit);
if (sep == Py_None) {
list = stringlib_split_whitespace((PyObject*)self, sbuf, slen, maxsplit);
goto done;
}

if (PyObject_GetBuffer(sep, &vsub, PyBUF_SIMPLE) != 0)
return NULL;
sub = vsub.buf;
n = vsub.len;
Py_buffer vsub;
if (PyObject_GetBuffer(sep, &vsub, PyBUF_SIMPLE) != 0) {
goto done;
}

list = stringlib_split(
(PyObject*) self, s, len, sub, n, maxsplit
);
list = stringlib_split((PyObject*)self, sbuf, slen,
(const char *)vsub.buf, vsub.len, maxsplit);
PyBuffer_Release(&vsub);

done:
self->ob_exports--;
return list;
}

Expand All @@ -1826,7 +1850,7 @@
static PyObject *
bytearray_partition_impl(PyByteArrayObject *self, PyObject *sep)
/*[clinic end generated code: output=b5fa1e03f10cfccb input=b87276af883f39d9]*/
{

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1853 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *bytesep, *result;

bytesep = _PyByteArray_FromBufferObject(sep);
Expand Down Expand Up @@ -1866,7 +1890,7 @@
static PyObject *
bytearray_rpartition_impl(PyByteArrayObject *self, PyObject *sep)
/*[clinic end generated code: output=0186ce7b1ef61289 input=5bdcfc4c333bcfab]*/
{

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1893 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *bytesep, *result;

bytesep = _PyByteArray_FromBufferObject(sep);
Expand Down Expand Up @@ -1899,27 +1923,33 @@
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
Py_ssize_t maxsplit)
/*[clinic end generated code: output=a55e0b5a03cb6190 input=60e9abf305128ff4]*/
{

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1926 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Py_ssize_t len = PyByteArray_GET_SIZE(self), n;
const char *s = PyByteArray_AS_STRING(self), *sub;
PyObject *list;
Py_buffer vsub;
PyObject *list = NULL;
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED((PyObject *)self);

self->ob_exports++;
const char *sbuf = PyByteArray_AS_STRING(self);
Py_ssize_t slen = PyByteArray_GET_SIZE((PyObject *)self);

if (maxsplit < 0)
maxsplit = PY_SSIZE_T_MAX;

if (sep == Py_None)
return stringlib_rsplit_whitespace((PyObject*) self, s, len, maxsplit);
if (sep == Py_None) {
list = stringlib_rsplit_whitespace((PyObject*)self, sbuf, slen, maxsplit);
goto done;
}

if (PyObject_GetBuffer(sep, &vsub, PyBUF_SIMPLE) != 0)
return NULL;
sub = vsub.buf;
n = vsub.len;
Py_buffer vsub;
if (PyObject_GetBuffer(sep, &vsub, PyBUF_SIMPLE) != 0) {
goto done;
}

list = stringlib_rsplit(
(PyObject*) self, s, len, sub, n, maxsplit
);
list = stringlib_rsplit((PyObject*)self, sbuf, slen,
(const char *)vsub.buf, vsub.len, maxsplit);
PyBuffer_Release(&vsub);

done:
self->ob_exports--;
return list;
}

Expand All @@ -1933,7 +1963,7 @@
static PyObject *
bytearray_reverse_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=9f7616f29ab309d3 input=2f3d5ce3180ffc53]*/
{

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 1966 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
char swap, *head, *tail;
Py_ssize_t i, j, n = Py_SIZE(self);

Expand Down Expand Up @@ -1974,7 +2004,7 @@
static PyObject *
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item)
/*[clinic end generated code: output=76c775a70e7b07b7 input=b3e14ede546dd8cc]*/
{

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2007 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Py_ssize_t n = Py_SIZE(self);
char *buf;

Expand All @@ -1997,7 +2027,7 @@

static PyObject *
bytearray_isalnum(PyObject *self, PyObject *Py_UNUSED(ignored))
{

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2030 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *ret;
Py_BEGIN_CRITICAL_SECTION(self);
ret = stringlib_isalnum(self, NULL);
Expand All @@ -2007,7 +2037,7 @@

static PyObject *
bytearray_isalpha(PyObject *self, PyObject *Py_UNUSED(ignored))
{

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2040 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *ret;
Py_BEGIN_CRITICAL_SECTION(self);
ret = stringlib_isalpha(self, NULL);
Expand All @@ -2017,7 +2047,7 @@

static PyObject *
bytearray_isascii(PyObject *self, PyObject *Py_UNUSED(ignored))
{

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2050 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *ret;
Py_BEGIN_CRITICAL_SECTION(self);
ret = stringlib_isascii(self, NULL);
Expand All @@ -2027,7 +2057,7 @@

static PyObject *
bytearray_isdigit(PyObject *self, PyObject *Py_UNUSED(ignored))
{

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Check failure on line 2060 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
PyObject *ret;
Py_BEGIN_CRITICAL_SECTION(self);
ret = stringlib_isdigit(self, NULL);
Expand Down Expand Up @@ -2739,8 +2769,8 @@
};

static PyMethodDef bytearray_methods[] = {
{"__alloc__", bytearray_alloc, METH_NOARGS, alloc_doc},

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

braces around scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

excess elements in scalar initializer

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

initialization of ‘PyMethodDef *’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]

Check warning on line 2772 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

braces around scalar initializer
BYTEARRAY_REDUCE_METHODDEF

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

braces around scalar initializer

Check warning on line 2773 in Objects/bytearrayobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

braces around scalar initializer
BYTEARRAY_REDUCE_EX_METHODDEF
BYTEARRAY_SIZEOF_METHODDEF
BYTEARRAY_APPEND_METHODDEF
Expand Down
Loading