https://github.com/python/cpython/commit/6c6600f6831aec15b2acbd7a9bb9c275bd5f4a32
commit: 6c6600f6831aec15b2acbd7a9bb9c275bd5f4a32
branch: main
author: mpage <mp...@meta.com>
committer: mpage <mp...@cs.stanford.edu>
date: 2025-03-06T12:11:50-08:00
summary:

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.

files:
M Lib/test/test_list.py

diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 2a34fd04f35059..725e07f3ad023f 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -1,3 +1,4 @@
+import signal
 import sys
 import textwrap
 from test import list_tests, support
@@ -324,8 +325,12 @@ def test_no_memory(self):
         _testcapi.set_nomemory(0)
         l = [None]
         """)
-        _, _, err = assert_python_failure("-c", code)
-        self.assertIn("MemoryError", err.decode("utf-8"))
+        rc, _, _ = assert_python_failure("-c", code)
+        if support.MS_WINDOWS:
+            # STATUS_ACCESS_VIOLATION
+            self.assertNotEqual(rc, 0xC0000005)
+        else:
+            self.assertNotEqual(rc, -int(signal.SIGSEGV))
 
 if __name__ == "__main__":
     unittest.main()

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to