colesbury · GitHub

Bug report

In #127524, @mpage suggested adding an assert to check that the list object is locked when calling ensure_shared_on_resize. This uncovers a few more locking issues.

Additionally, we may return out of the critical section without unlocking here:

Py_BEGIN_CRITICAL_SECTION(a);
Py_ssize_t n = PyList_GET_SIZE(a);
PyObject *copy = list_slice_lock_held(a, 0, n);
if (copy == NULL) {
return -1;
}
ret = list_ass_slice_lock_held(a, ilow, ihigh, copy);
Py_DECREF(copy);
Py_END_CRITICAL_SECTION();

Linked PRs

Read the original on github.com ↗