gh-117783: Immortalize objects that use deferred reference counting (#118112)

Deferred reference counting is not fully implemented yet. As a temporary
measure, we immortalize objects that would use deferred reference
counting to avoid multi-threaded scaling bottlenecks.

This is only performed in the free-threaded build once the first
non-main thread is started. Additionally, some tests, including refleak
tests, suppress this behavior.
This commit is contained in:
Sam Gross 2024-04-29 14:36:02 -04:00 committed by GitHub
parent 8d4b756fd3
commit 7ccacb220d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 134 additions and 8 deletions

View file

@ -1833,6 +1833,7 @@ class TestLRU:
return 1
self.assertEqual(f.cache_parameters(), {'maxsize': 1000, "typed": True})
@support.suppress_immortalization()
def test_lru_cache_weakrefable(self):
@self.module.lru_cache
def test_function(x):