mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Corrections
This commit is contained in:
parent
64811f0457
commit
d021a1bc77
@ -15,5 +15,7 @@ private:
|
|||||||
PythonInit();
|
PythonInit();
|
||||||
~PythonInit();
|
~PythonInit();
|
||||||
|
|
||||||
|
#if (PY_VERSION_HEX >= 0x03080000)
|
||||||
void handlePythonError(PyStatus status, PyConfig& config);
|
void handlePythonError(PyStatus status, PyConfig& config);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -57,13 +57,13 @@ static PyObject* hyperion_create(PyModuleDef* def, PyObject* args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Module deallocation function to clean up per-interpreter state
|
// 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
|
// No specific cleanup required in this example
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyModuleDef_Slot hyperion_slots[] = {
|
static PyModuleDef_Slot hyperion_slots[] = {
|
||||||
{Py_mod_exec, hyperion_exec},
|
{Py_mod_exec, reinterpret_cast<void*>(hyperion_exec)},
|
||||||
#if (PY_VERSION_HEX >= 0x030C0000)
|
#if (PY_VERSION_HEX >= 0x030C0000)
|
||||||
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
|
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,12 +178,14 @@ PythonInit::PythonInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Error handling function to replace goto exception
|
// Error handling function to replace goto exception
|
||||||
|
#if (PY_VERSION_HEX >= 0x03080000)
|
||||||
void PythonInit::handlePythonError(PyStatus status, PyConfig& config)
|
void PythonInit::handlePythonError(PyStatus status, PyConfig& config)
|
||||||
{
|
{
|
||||||
Error(Logger::getInstance("DAEMON"), "Initializing Python config failed with error [%s]", status.err_msg);
|
Error(Logger::getInstance("DAEMON"), "Initializing Python config failed with error [%s]", status.err_msg);
|
||||||
PyConfig_Clear(&config);
|
PyConfig_Clear(&config);
|
||||||
throw std::runtime_error("Initializing Python failed!");
|
throw std::runtime_error("Initializing Python failed!");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PythonInit::~PythonInit()
|
PythonInit::~PythonInit()
|
||||||
{
|
{
|
||||||
@ -196,4 +198,5 @@ PythonInit::~PythonInit()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int rc = Py_FinalizeEx();
|
int rc = Py_FinalizeEx();
|
||||||
|
Debug(Logger::getInstance("DAEMON"), "Cleaning up Python interpreter %s", rc == 0 ? "succeeded" : "failed");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user