Skip to content

Commit d217984

Browse files
committed
fix: fix build failed
1 parent f7583b2 commit d217984

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
@@ -1374,14 +1374,13 @@ static int
13741374
bytearray_contains(PyObject *self, PyObject *arg)
13751375
{
13761376
int ret;
1377-
Py_BEGIN_CRITICAL_SECTION(self);
13781377
Py_buffer selfbuf;
1379-
if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) != 0) {
1380-
Py_END_CRITICAL_SECTION();
1381-
return -1;
1378+
Py_BEGIN_CRITICAL_SECTION(self);
1379+
ret = -1;
1380+
if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) == 0) {
1381+
ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1382+
PyBuffer_Release(&selfbuf);
13821383
}
1383-
ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1384-
PyBuffer_Release(&selfbuf);
13851384
Py_END_CRITICAL_SECTION();
13861385
return ret;
13871386
}

0 commit comments

Comments
 (0)