Skip to content

Free threading locking issues in listobject.c #127536

Closed
@colesbury

Description

@colesbury

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

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14new features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions