bpo-30705: Fix test_regrtest.test_crashed() (#2439)
* Add test.support._crash_python() which triggers a crash but uses
test.support.SuppressCrashReport() to prevent a crash report from
popping up.
* Modify test_child_terminated_in_stopped_state() of test_subprocess
and test_crashed() of test_regrtest to use _crash_python().
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index af9b1d5..727f8d9 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -473,7 +473,7 @@
def test_crashed(self):
# Any code which causes a crash
- code = 'import ctypes; ctypes.string_at(0)'
+ code = 'import test.support; test.support._crash_python()'
crash_test = self.create_test(name="crash", code=code)
ok_test = self.create_test(name="ok")