(self)
| 96 | |
| 97 | @support.requires_subprocess() |
| 98 | def test_no_FatalError_infinite_loop(self): |
| 99 | code = textwrap.dedent(""" |
| 100 | import _testcapi |
| 101 | from test import support |
| 102 | |
| 103 | with support.SuppressCrashReport(): |
| 104 | _testcapi.crash_no_current_thread() |
| 105 | """) |
| 106 | |
| 107 | run_result, _cmd_line = run_python_until_end('-c', code) |
| 108 | _rc, out, err = run_result |
| 109 | self.assertEqual(out, b'') |
| 110 | # This used to cause an infinite loop. |
| 111 | if not support.Py_GIL_DISABLED: |
| 112 | msg = ("Fatal Python error: PyThreadState_Get: " |
| 113 | "the function must be called with the GIL held, " |
| 114 | "after Python initialization and before Python finalization, " |
| 115 | "but the GIL is released " |
| 116 | "(the current Python thread state is NULL)").encode() |
| 117 | else: |
| 118 | msg = ("Fatal Python error: PyThreadState_Get: " |
| 119 | "the function must be called with an active thread state, " |
| 120 | "after Python initialization and before Python finalization, " |
| 121 | "but it was called without an active thread state. " |
| 122 | "Are you trying to call the C API inside of a Py_BEGIN_ALLOW_THREADS block?").encode() |
| 123 | self.assertStartsWith(err.rstrip(), msg) |
| 124 | |
| 125 | def test_memoryview_from_NULL_pointer(self): |
| 126 | self.assertRaises(ValueError, _testcapi.make_memoryview_from_NULL_pointer) |
nothing calls this directly
no test coverage detected