From 87d3b9db4ade1aa100ee6f065082cb7e85b8992f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 25 Mar 2020 19:27:36 +0100 Subject: bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157) --- Python/pathconfig.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Python/pathconfig.c') diff --git a/Python/pathconfig.c b/Python/pathconfig.c index 3756e3a9b8..aa1d6f8139 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -484,6 +484,12 @@ pathconfig_global_init(void) /* External interface */ +static void _Py_NO_RETURN +path_out_of_memory(const char *func) +{ + _Py_FatalErrorFunc(func, "out of memory"); +} + void Py_SetPath(const wchar_t *path) { @@ -515,7 +521,7 @@ Py_SetPath(const wchar_t *path) || _Py_path_config.exec_prefix == NULL || _Py_path_config.module_search_path == NULL) { - Py_FatalError("out of memory"); + path_out_of_memory(__func__); } } @@ -536,7 +542,7 @@ Py_SetPythonHome(const wchar_t *home) PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); if (_Py_path_config.home == NULL) { - Py_FatalError("out of memory"); + path_out_of_memory(__func__); } } @@ -557,7 +563,7 @@ Py_SetProgramName(const wchar_t *program_name) PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); if (_Py_path_config.program_name == NULL) { - Py_FatalError("out of memory"); + path_out_of_memory(__func__); } } @@ -577,7 +583,7 @@ _Py_SetProgramFullPath(const wchar_t *program_full_path) PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); if (_Py_path_config.program_full_path == NULL) { - Py_FatalError("out of memory"); + path_out_of_memory(__func__); } } -- cgit v1.2.1