(self)
| 90 | # _PyRefchain_Trace() on memory allocation error. |
| 91 | @unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build') |
| 92 | def test_no_memory(self): |
| 93 | import_module("_testcapi") |
| 94 | # Issue #30696: Fix the interactive interpreter looping endlessly when |
| 95 | # no memory. Check also that the fix does not break the interactive |
| 96 | # loop when an exception is raised. |
| 97 | user_input = """ |
| 98 | import sys, _testcapi |
| 99 | 1/0 |
| 100 | print('After the exception.') |
| 101 | _testcapi.set_nomemory(0) |
| 102 | sys.exit(0) |
| 103 | """ |
| 104 | user_input = dedent(user_input) |
| 105 | p = spawn_repl() |
| 106 | with SuppressCrashReport(): |
| 107 | p.stdin.write(user_input) |
| 108 | output = kill_python(p) |
| 109 | self.assertIn('After the exception.', output) |
| 110 | # Exit code 120: Py_FinalizeEx() failed to flush stdout and stderr. |
| 111 | self.assertIn(p.returncode, (1, 120)) |
| 112 | |
| 113 | @cpython_only |
| 114 | def test_multiline_string_parsing(self): |
nothing calls this directly
no test coverage detected