Skip to content

Commit 87225ad

Browse files
committed
fix: fix build failed
1 parent 14963ea commit 87225ad

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Objects/bytearrayobject.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,14 +1359,13 @@ static int
13591359
bytearray_contains(PyObject *self, PyObject *arg)
13601360
{
13611361
int ret;
1362-
Py_BEGIN_CRITICAL_SECTION(self);
13631362
Py_buffer selfbuf;
1364-
if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) != 0) {
1365-
Py_END_CRITICAL_SECTION();
1366-
return -1;
1363+
Py_BEGIN_CRITICAL_SECTION(self);
1364+
ret = -1;
1365+
if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) == 0) {
1366+
ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1367+
PyBuffer_Release(&selfbuf);
13671368
}
1368-
ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1369-
PyBuffer_Release(&selfbuf);
13701369
Py_END_CRITICAL_SECTION();
13711370
return ret;
13721371
}

0 commit comments

Comments
 (0)