Skip to content

Commit

Permalink
Less code repetition
Browse files Browse the repository at this point in the history
  • Loading branch information
ndptech committed Nov 26, 2024
1 parent 8fb9dd6 commit f5ffff1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/modules/rlm_python3/rlm_python3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f5ffff1

Please sign in to comment.