Skip to content

Commit 6c6600f

Browse files
authored
gh-118331: Fix test_list.ListTest.test_no_memory under trace refs build (#130921)
Fix `test_list.ListTest.test_no_memory` under trace refs build Memory allocation ends up failing in _PyRefchainTrace(), which produces different output. Assert that we don't segfault, which is the thing we want to test and is less brittle than checking output.
1 parent c4d37ee commit 6c6600f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/test/test_list.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import signal
12
import sys
23
import textwrap
34
from test import list_tests, support
@@ -324,8 +325,12 @@ def test_no_memory(self):
324325
_testcapi.set_nomemory(0)
325326
l = [None]
326327
""")
327-
_, _, err = assert_python_failure("-c", code)
328-
self.assertIn("MemoryError", err.decode("utf-8"))
328+
rc, _, _ = assert_python_failure("-c", code)
329+
if support.MS_WINDOWS:
330+
# STATUS_ACCESS_VIOLATION
331+
self.assertNotEqual(rc, 0xC0000005)
332+
else:
333+
self.assertNotEqual(rc, -int(signal.SIGSEGV))
329334

330335
if __name__ == "__main__":
331336
unittest.main()

0 commit comments

Comments
 (0)