]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-131988: Fix a multithreaded scaling regression (#131989)
authorSam Gross <colesbury@gmail.com>
Mon, 7 Apr 2025 18:13:02 +0000 (14:13 -0400)
committerGitHub <noreply@github.com>
Mon, 7 Apr 2025 18:13:02 +0000 (20:13 +0200)
commit1fcf409acef8a7a039353cf11a0bbb24ca6722f8
tree1bdb6951ceb073e0f8ce1d6fec4aaa6c4a102e7b
parentbd2f518555e8da6690757645e6b8dde932e1a41d
[3.13] gh-131988: Fix a multithreaded scaling regression (#131989)

gh-131988: Fix a multithreaded scaling regression

The 3.13 free threaded build immortalizes certain objects to avoid
reference count contention. In gh-127114 the condition was
unintentionally changed to happen when the first thread was created
instead of the first non-main thread. The `interp->gc.immortalize` field
is then cleared again during `_PyGC_Init()`.

Change the condition so that we check if we should immortalize objects
using deferred reference counting whenever a non-main thread is created.
Misc/NEWS.d/next/Core_and_Builtins/2025-04-01-19-25-05.gh-issue-131988.sbYLEs.rst [new file with mode: 0644]
Python/pystate.c