]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886...
authorSam Gross <colesbury@gmail.com>
Thu, 23 Apr 2026 19:12:19 +0000 (15:12 -0400)
committerGitHub <noreply@github.com>
Thu, 23 Apr 2026 19:12:19 +0000 (19:12 +0000)
commit26c6e3d7e381578e5e39cd6e800743e48c8c8697
treee183be74f42611b30cdd15a24761f2458981feb7
parent31ba91a35eb2e2a370734cdb4d3d3089a3272048
[3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886) (#148927)

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 4629c2215a9a4b3d1ec4a306cd4dd7d11dcfebb4)
Lib/test/test_free_threading/test_str.py
Misc/NEWS.d/next/Core_and_Builtins/2026-04-22-14-55-18.gh-issue-113956.0VEXd6.rst [new file with mode: 0644]
Objects/object.c
Objects/unicodeobject.c