SIGN IN SIGN UP

[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.
S
Sam Gross committed
1fcf409acef8a7a039353cf11a0bbb24ca6722f8
Parent: bd2f518
Committed by GitHub <noreply@github.com> on 4/7/2025, 6:13:02 PM