We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14963ea commit 87225adCopy full SHA for 87225ad
1 file changed
Objects/bytearrayobject.c
@@ -1359,14 +1359,13 @@ static int
1359
bytearray_contains(PyObject *self, PyObject *arg)
1360
{
1361
int ret;
1362
- Py_BEGIN_CRITICAL_SECTION(self);
1363
Py_buffer selfbuf;
1364
- if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) != 0) {
1365
- Py_END_CRITICAL_SECTION();
1366
- return -1;
+ Py_BEGIN_CRITICAL_SECTION(self);
+ ret = -1;
+ if (PyObject_GetBuffer((PyObject *)self, &selfbuf, PyBUF_SIMPLE) == 0) {
+ ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1367
+ PyBuffer_Release(&selfbuf);
1368
}
- ret = _Py_bytes_contains((const char *)selfbuf.buf, selfbuf.len, arg);
1369
- PyBuffer_Release(&selfbuf);
1370
Py_END_CRITICAL_SECTION();
1371
return ret;
1372
0 commit comments