Skip to content

Commit cd6034d

Browse files
committed
gh-130851: Skip test_unusual_constants under refleak checker
The test immortalizes some regular object instances, which causes the refleak checks to fail.
1 parent 02de9cb commit cd6034d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_code.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
check_impl_detail, requires_debug_ranges,
213213
gc_collect, Py_GIL_DISABLED)
214214
from test.support.script_helper import assert_python_ok
215-
from test.support import threading_helper, import_helper
215+
from test.support import threading_helper, import_helper, refleak_helper
216216
from test.support.bytecode_helper import instructions_with_positions
217217
from opcode import opmap, opname
218218
from _testcapi import code_offset_to_line
@@ -667,6 +667,11 @@ def func2():
667667

668668
@cpython_only
669669
def test_unusual_constants(self):
670+
# We cannot use the @skipIf here because hunting_for_refleaks()
671+
# is only true once we start executing the test.
672+
if Py_GIL_DISABLED and refleak_helper.hunting_for_refleaks():
673+
raise unittest.SkipTest("Immortalized objects trigger refleak detection")
674+
670675
# gh-130851: Code objects constructed with constants that are not
671676
# types generated by the bytecode compiler should not crash the
672677
# interpreter.

0 commit comments

Comments
 (0)