Skip to content

[3.15] gh-158197: Fix split dict iteration during concurrent deletion (gh-158686) - #159953

Open
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-4bb1dad-3.15
Open

miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-4bb1dad-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Read insertion order from the iterator's captured values snapshot instead
of re-reading ma_values and asserting against a concurrently changing
size. Retry under the dictionary lock when a value slot has been cleared.

Make insertion-order writes atomic and publish size changes with release
stores, pairing with the iterator's size load. Keep order-byte accesses
relaxed. Add _Py_atomic_store_uint8_release() and
FT_ATOMIC_STORE_UINT8_RELEASE() for this.
(cherry picked from commit 4bb1dad)

Co-authored-by: Neil Schemenauer nas-github@arctrix.com

…ythongh-158686)

Read insertion order from the iterator's captured values snapshot instead
of re-reading ma_values and asserting against a concurrently changing
size. Retry under the dictionary lock when a value slot has been cleared.

Make insertion-order writes atomic and publish size changes with release
stores, pairing with the iterator's size load. Keep order-byte accesses
relaxed. Add _Py_atomic_store_uint8_release() and
FT_ATOMIC_STORE_UINT8_RELEASE() for this.
(cherry picked from commit 4bb1dad)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review topic-free-threading type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants