Skip to content

Commit

Permalink
Check for Python version when using PyPreConfig
Browse files Browse the repository at this point in the history
PyPreConfig is new feature of Python 3.8. Currently TRIK toolchain uses Python 3.5 which fails to build without guards
  • Loading branch information
WoWaster committed Aug 29, 2023
1 parent 624bfd1 commit feaf5ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion trikScriptRunner/src/pythonEngineWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void PythonEngineWorker::init()
} else {
QLOG_INFO() << varName << ":" << path;
}
#if PY_MINOR_VERSION >= 8
PyPreConfig pyPreconfig;
PyPreConfig_InitPythonConfig(&pyPreconfig);

Expand All @@ -126,8 +127,9 @@ void PythonEngineWorker::init()
throw trikKernel::InternalErrorException(e);
}

/// TODO: Must point to local .zip file
/// NB! Py_DecodeLocale requires a pre-initialized Python engine
#endif
/// TODO: Must point to local .zip file
mPythonPath = Py_DecodeLocale(path.toStdString().data(), nullptr);
Py_SetPath(mPythonPath);

Expand Down

0 comments on commit feaf5ac

Please sign in to comment.