mirror of https://github.com/python/cpython
[3.13] gh-118846: Fix PGO tests in free-threaded build (GH-118862) (#118867)
Avoid immortalizing objects in tests that verify garbage collection of
classes or modules.
This fixes test_ordered_dict and test_struct.
(cherry picked from commit 1b1db2fd9a
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
0a23970478
commit
d4c6948340
|
@ -10,7 +10,7 @@ import unittest
|
||||||
import weakref
|
import weakref
|
||||||
from collections.abc import MutableMapping
|
from collections.abc import MutableMapping
|
||||||
from test import mapping_tests, support
|
from test import mapping_tests, support
|
||||||
from test.support import import_helper
|
from test.support import import_helper, suppress_immortalization
|
||||||
|
|
||||||
|
|
||||||
py_coll = import_helper.import_fresh_module('collections',
|
py_coll = import_helper.import_fresh_module('collections',
|
||||||
|
@ -667,6 +667,7 @@ class OrderedDictTests:
|
||||||
dict.update(od, [('spam', 1)])
|
dict.update(od, [('spam', 1)])
|
||||||
self.assertNotIn('NULL', repr(od))
|
self.assertNotIn('NULL', repr(od))
|
||||||
|
|
||||||
|
@suppress_immortalization()
|
||||||
def test_reference_loop(self):
|
def test_reference_loop(self):
|
||||||
# Issue 25935
|
# Issue 25935
|
||||||
OrderedDict = self.OrderedDict
|
OrderedDict = self.OrderedDict
|
||||||
|
|
|
@ -9,7 +9,7 @@ import sys
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import import_helper
|
from test.support import import_helper, suppress_immortalization
|
||||||
from test.support.script_helper import assert_python_ok
|
from test.support.script_helper import assert_python_ok
|
||||||
|
|
||||||
ISBIGENDIAN = sys.byteorder == "big"
|
ISBIGENDIAN = sys.byteorder == "big"
|
||||||
|
@ -674,6 +674,7 @@ class StructTest(unittest.TestCase):
|
||||||
self.assertIn(b"Exception ignored in:", stderr)
|
self.assertIn(b"Exception ignored in:", stderr)
|
||||||
self.assertIn(b"C.__del__", stderr)
|
self.assertIn(b"C.__del__", stderr)
|
||||||
|
|
||||||
|
@suppress_immortalization()
|
||||||
def test__struct_reference_cycle_cleaned_up(self):
|
def test__struct_reference_cycle_cleaned_up(self):
|
||||||
# Regression test for python/cpython#94207.
|
# Regression test for python/cpython#94207.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue