gh-126366: fix thread safety of dict key iterator (#132693)

This commit is contained in:
Kumar Aditya 2025-04-18 21:43:49 +05:30 committed by GitHub
parent 7fd708b727
commit 4c3d187d9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5495,7 +5495,7 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
ensure_shared_on_read(d);
i = _Py_atomic_load_ssize_relaxed(&di->di_pos);
k = _Py_atomic_load_ptr_relaxed(&d->ma_keys);
k = _Py_atomic_load_ptr_acquire(&d->ma_keys);
assert(i >= 0);
if (_PyDict_HasSplitTable(d)) {
PyDictValues *values = _Py_atomic_load_ptr_relaxed(&d->ma_values);