mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
c4d37eefb7
commit
6c6600f683
1 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import signal
|
||||
import sys
|
||||
import textwrap
|
||||
from test import list_tests, support
|
||||
|
@ -324,8 +325,12 @@ class ListTest(list_tests.CommonTest):
|
|||
_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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue