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/Python/pathconfig.c b/Python/pathconfig.c
index e37b561..3756e3a 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -515,7 +515,7 @@
|| _Py_path_config.exec_prefix == NULL
|| _Py_path_config.module_search_path == NULL)
{
- Py_FatalError("Py_SetPath() failed: out of memory");
+ Py_FatalError("out of memory");
}
}
@@ -536,7 +536,7 @@
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
if (_Py_path_config.home == NULL) {
- Py_FatalError("Py_SetPythonHome() failed: out of memory");
+ Py_FatalError("out of memory");
}
}
@@ -557,7 +557,7 @@
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
if (_Py_path_config.program_name == NULL) {
- Py_FatalError("Py_SetProgramName() failed: out of memory");
+ Py_FatalError("out of memory");
}
}
@@ -577,7 +577,7 @@
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
if (_Py_path_config.program_full_path == NULL) {
- Py_FatalError("_Py_SetProgramFullPath() failed: out of memory");
+ Py_FatalError("out of memory");
}
}