From a56cc6bd1a9d98794979c2b9910d278e06400756 Mon Sep 17 00:00:00 2001 From: Ovidiu MIRCESCU Date: Tue, 6 Apr 2021 14:16:14 +0200 Subject: [PATCH] For future compatibility with python 3.9. see https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads --- src/runtime/RuntimeSALOME.cxx | 2 ++ src/ydfx_gui/YDFXGUIPushButtons.cxx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/runtime/RuntimeSALOME.cxx b/src/runtime/RuntimeSALOME.cxx index fb2727afa..99f577152 100644 --- a/src/runtime/RuntimeSALOME.cxx +++ b/src/runtime/RuntimeSALOME.cxx @@ -314,7 +314,9 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[]) } PySys_SetArgv(pyArgc, changed_pyArgv); } +#if PY_VERSION_HEX < 0x03070000 PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/ +#endif PyEval_SaveThread(); /* Release the thread state */ //here we do not have the Global Interpreter Lock } diff --git a/src/ydfx_gui/YDFXGUIPushButtons.cxx b/src/ydfx_gui/YDFXGUIPushButtons.cxx index 6f4b541a1..76189f33f 100644 --- a/src/ydfx_gui/YDFXGUIPushButtons.cxx +++ b/src/ydfx_gui/YDFXGUIPushButtons.cxx @@ -304,8 +304,10 @@ void YDFXGUIRunningButton::runEvaluation() { if(!getSess()->isLaunched()) getSess()->launch(); +#if PY_VERSION_HEX < 0x03070000 if(!PyEval_ThreadsInitialized()) PyEval_InitThreads(); +#endif connect(getThread(),SIGNAL(finished()),this,SLOT(evaluationFinished())); setEnabled(false); getThread()->start(); -- 2.39.2