diff options
| author | 2025-01-16 01:57:37 -0500 | |
|---|---|---|
| committer | 2025-01-16 01:57:37 -0500 | |
| commit | 81a21e6ce040e7740de86340c8ea4dba30e69bc3 (patch) | |
| tree | 95fc1741b907d5ba6d029a42d80092cb7c056c5e /Plugins/ScriptingPython | |
| parent | 3565aad630864ecdbe53fdaa501ea708555b3c7c (diff) | |
New upstream version 3.4.13+dfsg.upstream/3.4.13+dfsgupstream
Diffstat (limited to 'Plugins/ScriptingPython')
| -rw-r--r-- | Plugins/ScriptingPython/scriptingpython.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Plugins/ScriptingPython/scriptingpython.cpp b/Plugins/ScriptingPython/scriptingpython.cpp index 1dedb5c..a8de694 100644 --- a/Plugins/ScriptingPython/scriptingpython.cpp +++ b/Plugins/ScriptingPython/scriptingpython.cpp @@ -582,15 +582,25 @@ SqlQueryPtr ScriptingPython::dbCommonEval(PyObject* sqlArg, const char* fnName) QVariant ScriptingPython::getVariable(const QString& name) { PyThreadState* state = PyThreadState_Get(); - if (!state->frame) +#if PY_VERSION_HEX < 0x030a0000 + PyFrameObject* frame = state->frame; +#else + PyFrameObject* frame = PyThreadState_GetFrame(state); +#endif + if (!frame) return QVariant(); const char* varName = name.toUtf8().constData(); PyObject* obj = nullptr; - PyFrame_FastToLocals(state->frame); - PyObject* locals = state->frame->f_locals; - PyObject* globals = state->frame->f_globals; + PyFrame_FastToLocals(frame); +#if PY_VERSION_HEX < 0x030b0000 + PyObject* locals = frame->f_locals; + PyObject* globals = frame->f_globals; +#else + PyObject* locals = PyFrame_GetLocals(frame); + PyObject* globals = PyFrame_GetGlobals(frame); +#endif if (PyMapping_Check(locals)) obj = PyMapping_GetItemString(locals, varName); else if (PyDict_Check(globals)) |
