While reviewing #130096, I checked the thread safety of list object and there at some places we are missing atomic stores of index.
Specifically the following:
|
else if (index > PyList_GET_SIZE(it->it_seq)) |
|
index = PyList_GET_SIZE(it->it_seq); /* iterator exhausted */ |
|
it->it_index = index; |
|
} |
|
else if (index > PyList_GET_SIZE(it->it_seq) - 1) |
|
index = PyList_GET_SIZE(it->it_seq) - 1; |
|
it->it_index = index; |
|
} |
They should use atomic relaxed stores.
Linked PRs