CodeQL findings

This commit is contained in:
LordGrey 2024-12-01 16:21:39 +01:00
parent 5eb32f852b
commit 2d405baa8a
2 changed files with 4 additions and 20 deletions

View File

@ -38,24 +38,6 @@ static int hyperion_exec(PyObject* module) {
return 0;
}
// Module creation function for multi-phase init, used in Py_mod_create slot
static PyObject* hyperion_create(PyModuleDef* def, PyObject* args) {
PyObject* module = PyModule_Create(def);
if (!module)
{
return NULL;
}
// Execute any additional module initialization logic
if (hyperion_exec(module) < 0)
{
Py_DECREF(module);
return NULL;
}
return module;
}
// Module deallocation function to clean up per-interpreter state
static void hyperion_free(void* /* module */)
{

View File

@ -81,9 +81,11 @@ void PythonProgram::execute(const QByteArray& python_code)
{
return;
}
#if (PY_VERSION_HEX < 0x030C0000)
PyThreadState_Swap(_tstate);
#else
PyThreadState* prev_thread_state = PyThreadState_Swap(_tstate);
#endif
PyObject* main_module = PyImport_ImportModule("__main__");
if (!main_module)
{