From d021a1bc77a960cf22e071eed05e026123ecae51 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:37:43 +0100 Subject: [PATCH] Corrections --- include/python/PythonInit.h | 2 ++ libsrc/effectengine/EffectModule.cpp | 4 ++-- libsrc/python/PythonInit.cpp | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/python/PythonInit.h b/include/python/PythonInit.h index bb309116..316d8464 100644 --- a/include/python/PythonInit.h +++ b/include/python/PythonInit.h @@ -15,5 +15,7 @@ private: PythonInit(); ~PythonInit(); +#if (PY_VERSION_HEX >= 0x03080000) void handlePythonError(PyStatus status, PyConfig& config); +#endif }; diff --git a/libsrc/effectengine/EffectModule.cpp b/libsrc/effectengine/EffectModule.cpp index f80035d3..69c01f1f 100644 --- a/libsrc/effectengine/EffectModule.cpp +++ b/libsrc/effectengine/EffectModule.cpp @@ -57,13 +57,13 @@ static PyObject* hyperion_create(PyModuleDef* def, PyObject* args) { } // Module deallocation function to clean up per-interpreter state -static void hyperion_free(void* module) +static void hyperion_free(void* /* module */) { // No specific cleanup required in this example } static PyModuleDef_Slot hyperion_slots[] = { - {Py_mod_exec, hyperion_exec}, + {Py_mod_exec, reinterpret_cast(hyperion_exec)}, #if (PY_VERSION_HEX >= 0x030C0000) {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, #endif diff --git a/libsrc/python/PythonInit.cpp b/libsrc/python/PythonInit.cpp index 31375ad1..5f8067fb 100644 --- a/libsrc/python/PythonInit.cpp +++ b/libsrc/python/PythonInit.cpp @@ -178,12 +178,14 @@ PythonInit::PythonInit() } // Error handling function to replace goto exception +#if (PY_VERSION_HEX >= 0x03080000) void PythonInit::handlePythonError(PyStatus status, PyConfig& config) { Error(Logger::getInstance("DAEMON"), "Initializing Python config failed with error [%s]", status.err_msg); PyConfig_Clear(&config); throw std::runtime_error("Initializing Python failed!"); } +#endif PythonInit::~PythonInit() { @@ -196,4 +198,5 @@ PythonInit::~PythonInit() #endif int rc = Py_FinalizeEx(); + Debug(Logger::getInstance("DAEMON"), "Cleaning up Python interpreter %s", rc == 0 ? "succeeded" : "failed"); }