summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_faulthandler.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-06 23:54:20 (GMT)
committerGitHub <noreply@github.com>2020-03-06 23:54:20 (GMT)
commit9e5d30cc99e34f4c3e7b2cd851de20816c9d1927 (patch)
tree71e726c4695b9b3b0a31d7d2516ce8ee83b52721 /Lib/test/test_faulthandler.py
parent7b3c252dc7f44d4bdc4c7c82d225ebd09c78f520 (diff)
downloadcpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.zip
cpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.tar.gz
cpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.tar.bz2
bpo-39882: Py_FatalError() logs the function name (GH-18819)
The Py_FatalError() function is replaced with a macro which logs automatically the name of the current function, unless the Py_LIMITED_API macro is defined. Changes: * Add _Py_FatalErrorFunc() function. * Remove the function name from the message of Py_FatalError() calls which included the function name. * Update tests.
Diffstat (limited to 'Lib/test/test_faulthandler.py')
-rw-r--r--Lib/test/test_faulthandler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index ac8cf46..c64afe8 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -123,7 +123,9 @@ class FaultHandlerTests(unittest.TestCase):
self.assertRegex(output, regex)
self.assertNotEqual(exitcode, 0)
- def check_fatal_error(self, code, line_number, name_regex, **kw):
+ def check_fatal_error(self, code, line_number, name_regex, func=None, **kw):
+ if func:
+ name_regex = '%s: %s' % (func, name_regex)
fatal_error = 'Fatal Python error: %s' % name_regex
self.check_error(code, line_number, fatal_error, **kw)
@@ -173,6 +175,7 @@ class FaultHandlerTests(unittest.TestCase):
3,
'in new thread',
know_current_thread=False,
+ func='faulthandler_fatal_error_thread',
py_fatal_error=True)
def test_sigabrt(self):
@@ -230,6 +233,7 @@ class FaultHandlerTests(unittest.TestCase):
""",
2,
'xyz',
+ func='faulthandler_fatal_error_py',
py_fatal_error=True)
def test_fatal_error_without_gil(self):
@@ -239,6 +243,7 @@ class FaultHandlerTests(unittest.TestCase):
""",
2,
'xyz',
+ func='faulthandler_fatal_error_py',
py_fatal_error=True)
@unittest.skipIf(sys.platform.startswith('openbsd'),