mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)
Move faulthandler._fatal_error() to _testcapi.fatal_error().
This commit is contained in:
parent
998ae1fa3f
commit
e232025025
4 changed files with 48 additions and 39 deletions
|
@ -227,25 +227,23 @@ class FaultHandlerTests(unittest.TestCase):
|
|||
5,
|
||||
'Illegal instruction')
|
||||
|
||||
def check_fatal_error_func(self, release_gil):
|
||||
# Test that Py_FatalError() dumps a traceback
|
||||
with support.SuppressCrashReport():
|
||||
self.check_fatal_error(f"""
|
||||
import _testcapi
|
||||
_testcapi.fatal_error(b'xyz', {release_gil})
|
||||
""",
|
||||
2,
|
||||
'xyz',
|
||||
func='test_fatal_error',
|
||||
py_fatal_error=True)
|
||||
|
||||
def test_fatal_error(self):
|
||||
self.check_fatal_error("""
|
||||
import faulthandler
|
||||
faulthandler._fatal_error(b'xyz')
|
||||
""",
|
||||
2,
|
||||
'xyz',
|
||||
func='faulthandler_fatal_error_py',
|
||||
py_fatal_error=True)
|
||||
self.check_fatal_error_func(False)
|
||||
|
||||
def test_fatal_error_without_gil(self):
|
||||
self.check_fatal_error("""
|
||||
import faulthandler
|
||||
faulthandler._fatal_error(b'xyz', True)
|
||||
""",
|
||||
2,
|
||||
'xyz',
|
||||
func='faulthandler_fatal_error_py',
|
||||
py_fatal_error=True)
|
||||
self.check_fatal_error_func(True)
|
||||
|
||||
@unittest.skipIf(sys.platform.startswith('openbsd'),
|
||||
"Issue #12868: sigaltstack() doesn't work on "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue