Skip to content

Commit 2407005

Browse files
committed
Fix CI: force fresh list buffer alloc in test_no_memory (gh-126703)
Small-list freelist entries keep their ob_item buffers, so a plain [None] after inject_memory_error() may succeed instead of failing. Repeat the list to a size the freelists cannot satisfy, forcing a real allocation. Co-authored-by: Muse Code (Meta Muse Spark)
1 parent 69dd56b commit 2407005

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/test/test_list.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ def test_no_memory(self):
384384
None, None, None, None, None, None, None, None, None,]
385385
del l
386386
support.inject_memory_error()
387-
l = [None]
387+
# Repeat to force a fresh ob_item allocation: entries on the small
388+
# list freelists keep their buffers, so a plain [None] may succeed.
389+
l = [None] * 30
388390
""")
389391
rc, _, _ = assert_python_failure("-c", code)
390392
if support.MS_WINDOWS:

0 commit comments

Comments
 (0)