mirror of
https://github.com/python/cpython.git
synced 2025-07-22 02:35:22 +00:00
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:
parent
8d4b756fd3
commit
7ccacb220d
13 changed files with 134 additions and 8 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue