Skip to content

Commit 498222b

Browse files
committed
Add a test.
1 parent bf52ecf commit 498222b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_gc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,18 @@ def test_tuple_untrack_counts(self):
12491249
self.assertTrue(new_count - count > (n // 2))
12501250

12511251

1252+
@threading_helper.requires_working_threading()
1253+
def test_concurrent_freeze_unfreeze():
1254+
# GH-142975: On the free-threaded build, this would cause problems
1255+
# with objects that had a per-thread reference count.
1256+
def weird():
1257+
gc.freeze()
1258+
gc.collect()
1259+
gc.unfreeze()
1260+
1261+
threading_helper.run_concurrently(weird, 4)
1262+
1263+
12521264
class IncrementalGCTests(unittest.TestCase):
12531265
@unittest.skipIf(_testinternalcapi is None, "requires _testinternalcapi")
12541266
@requires_gil_enabled("Free threading does not support incremental GC")

0 commit comments

Comments
 (0)