From f5ffff13ea454e6b1f865a59d99920256c3f0573 Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Tue, 26 Nov 2024 08:55:53 +0000 Subject: [PATCH] Less code repetition --- src/modules/rlm_python3/rlm_python3.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/rlm_python3/rlm_python3.c b/src/modules/rlm_python3/rlm_python3.c index 5b2b03ee2103..522fcdb8cdef 100644 --- a/src/modules/rlm_python3/rlm_python3.c +++ b/src/modules/rlm_python3/rlm_python3.c @@ -1222,16 +1222,14 @@ static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf) memcpy(&p, &inst->python_path, sizeof(path)); for (path = strtok(p, ":"); path != NULL; path = strtok(NULL, ":")) { -#if PY_VERSION_HEX > 0x03050000 +#if PY_VERSION_HEX > 0x03000000 wchar_t *py_path; +#if PY_VERSION_HEX > 0x03050000 MEM(py_path = Py_DecodeLocale(path, NULL)); - PyList_Append(sys_path, PyUnicode_FromWideChar(py_path, -1)); - PyMem_RawFree(py_path); -#elif PY_VERSION_HEX > 0x03000000 - wchar_t *py_path; - +#else MEM(py_path = _Py_char2wchar(path, NULL)); +#endif PyList_Append(sys_path, PyUnicode_FromWideChar(py_path, -1)); PyMem_RawFree(py_path); #else