aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-04-29 14:36:02 -0400
committerGitHub <noreply@github.com>2024-04-29 14:36:02 -0400
commit7ccacb220d99662b626c8bc63b00a27eaf604f0c (patch)
tree231cb901ee62e523be237392b0f2b966aa8be128 /Lib/test/test_weakref.py
parent8d4b756fd31d4d91b55105b1241561e92cc571a3 (diff)
downloadcpython-7ccacb220d99662b626c8bc63b00a27eaf604f0c.tar.gz
cpython-7ccacb220d99662b626c8bc63b00a27eaf604f0c.zip
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.
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index a2f5b9b2902..df90647baee 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -13,7 +13,7 @@ import random
import textwrap
from test import support
-from test.support import script_helper, ALWAYS_EQ
+from test.support import script_helper, ALWAYS_EQ, suppress_immortalization
from test.support import gc_collect
from test.support import import_helper
from test.support import threading_helper
@@ -651,6 +651,7 @@ class ReferencesTestCase(TestBase):
# deallocation of c2.
del c2
+ @suppress_immortalization()
def test_callback_in_cycle(self):
import gc
@@ -743,6 +744,7 @@ class ReferencesTestCase(TestBase):
del c1, c2, C, D
gc.collect()
+ @suppress_immortalization()
def test_callback_in_cycle_resurrection(self):
import gc
@@ -878,6 +880,7 @@ class ReferencesTestCase(TestBase):
# No exception should be raised here
gc.collect()
+ @suppress_immortalization()
def test_classes(self):
# Check that classes are weakrefable.
class A(object):