Skip to content

[3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886)#148927

Merged
colesbury merged 1 commit intopython:3.14from
colesbury:backport-4629c22-3.14
Apr 23, 2026
Merged

[3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886)#148927
colesbury merged 1 commit intopython:3.14from
colesbury:backport-4629c22-3.14

Conversation

@colesbury
Copy link
Copy Markdown
Contributor

@colesbury colesbury commented Apr 23, 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.

(cherry picked from commit 4629c22)

…ed build (pythongh-148886)

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.
(cherry picked from commit 4629c22)

Co-authored-by: Sam Gross <[email protected]>
@colesbury colesbury enabled auto-merge (squash) April 23, 2026 18:46
@colesbury colesbury merged commit 26c6e3d into python:3.14 Apr 23, 2026
52 checks passed
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.

1 participant