Skip to content

Commit b0b0c50

Browse files
committed
boil: test_opcache drops a Py_GC-guarded refcount check
Removed from the CALL_LIST_APPEND resize-failure test (pythongh-151818) the check, guarded by `not Py_GC`, that the argument's refcount was restored. The test still checks that the failed append leaves the list empty.
1 parent c1fa70b commit b0b0c50

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎Lib/test/test_opcache.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import unittest
99
from test.support import (threading_helper, check_impl_detail,
1010
requires_specialization,
11-
cpython_only, reset_code, Py_GC, Py_SHAPES)
11+
cpython_only, reset_code, Py_SHAPES)
1212
from test.support.import_helper import import_module
1313

1414
# Skip this module on other interpreters, it is cpython specific:
@@ -2300,12 +2300,11 @@ def list_append(l, holder):
23002300
l.append(holder.item)
23012301

23022302
holder = Holder()
2303-
holder.item = item = object()
2303+
holder.item = object()
23042304
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
23052305
list_append([], holder)
23062306
self.assert_specialized(list_append, "CALL_LIST_APPEND")
23072307

2308-
refcount = sys.getrefcount(item) if not Py_GC else None
23092308
# An empty list has no spare capacity, so append() must resize it.
23102309
lst = []
23112310
with self.assertRaises(MemoryError):
@@ -2315,8 +2314,6 @@ def list_append(l, holder):
23152314
finally:
23162315
_testcapi.remove_mem_hooks()
23172316
self.assertEqual(lst, [])
2318-
if not Py_GC:
2319-
self.assertEqual(sys.getrefcount(item), refcount)
23202317

23212318
@cpython_only
23222319
@requires_specialization

0 commit comments

Comments
 (0)