Skip to content

Commit af5b63c

Browse files
committed
add lock held assertions
1 parent 061aa02 commit af5b63c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Modules/_io/bytesio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,8 @@ _io_BytesIO___init___impl(bytesio *self, PyObject *initvalue)
10431043
static PyObject *
10441044
bytesio_sizeof_lock_held(PyObject *op)
10451045
{
1046+
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op);
1047+
10461048
bytesio *self = bytesio_CAST(op);
10471049
size_t res = _PyObject_SIZE(Py_TYPE(self));
10481050
if (self->buf && !SHARED_BUF(self)) {
@@ -1168,6 +1170,10 @@ bytesiobuf_getbuffer(PyObject *op, Py_buffer *view, int flags)
11681170
"bytesiobuf_getbuffer: view==NULL argument is obsolete");
11691171
return -1;
11701172
}
1173+
1174+
/* assertion not above because of test_pep3118_obsolete_write_locks() */
1175+
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(b);
1176+
11711177
if (FT_ATOMIC_LOAD_SSIZE_RELAXED(b->exports) == 0 && SHARED_BUF(b)) {
11721178
if (unshare_buffer_lock_held(b, b->string_size) < 0)
11731179
return -1;

0 commit comments

Comments
 (0)