Skip to content

gh-113956: Make intern_common thread-safe in free-threaded build#148886

Open
colesbury wants to merge 2 commits intopython:mainfrom
colesbury:gh-113956-intern-common-thread-safe
Open

gh-113956: Make intern_common thread-safe in free-threaded build#148886
colesbury wants to merge 2 commits intopython:mainfrom
colesbury:gh-113956-intern-common-thread-safe

Conversation

@colesbury
Copy link
Copy Markdown
Contributor

@colesbury colesbury commented Apr 22, 2026

Avoid racing with the owning thread's refcount operations when immortalizing an interned string: if we don't own it and its refcount isn't merged, intern a copy we own instead. Use atomic stores in _Py_SetImmortalUntracked so concurrent atomic reads are race-free.

Avoid racing with the owning thread's refcount operations when
immortalizing an interned string: if we don't own it and its refcount
isn't merged, intern a copy we own instead. Use atomic stores in
_Py_SetImmortalUntracked so concurrent atomic reads are race-free.
@colesbury colesbury marked this pull request as ready for review April 22, 2026 19:49
@colesbury colesbury requested a review from mpage April 22, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants