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.
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index c5bd8a4..027f87e 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -269,6 +269,8 @@
finally:
sys.setrecursionlimit(oldlimit)
+ # The error message is specific to CPython
+ @test.support.cpython_only
def test_recursionlimit_fatalerror(self):
# A fatal error occurs if a second recursion limit is hit when recovering
# from a first one.
@@ -290,7 +292,8 @@
err = sub.communicate()[1]
self.assertTrue(sub.returncode, sub.returncode)
self.assertIn(
- b"Fatal Python error: Cannot recover from stack overflow",
+ b"Fatal Python error: _Py_CheckRecursiveCall: "
+ b"Cannot recover from stack overflow",
err)
def test_getwindowsversion(self):