]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886)
authorSam Gross <colesbury@gmail.com>
Thu, 23 Apr 2026 18:42:57 +0000 (14:42 -0400)
committerGitHub <noreply@github.com>
Thu, 23 Apr 2026 18:42:57 +0000 (14:42 -0400)
commit4629c2215a9a4b3d1ec4a306cd4dd7d11dcfebb4
tree3343a0032fec3391ef85ad5ee07751435c8dcb89
parent42d645a7e81e0a5e6e0d35e222a8520450ac28ef
gh-113956: Make intern_common thread-safe in free-threaded build (gh-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.
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