]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
For future compatibility with python 3.9.
authorOvidiu MIRCESCU <ovidiu.mircescu@edf.fr>
Tue, 6 Apr 2021 11:23:24 +0000 (13:23 +0200)
committerOvidiu MIRCESCU <ovidiu.mircescu@edf.fr>
Tue, 6 Apr 2021 11:23:24 +0000 (13:23 +0200)
see https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads

src/SUITApp/SUITApp_init_python.cxx
tools/PyInterp/src/PyInterp_Interp.cxx

index 2959c7a80c6308ff92441463a284bbb1e45af19d..5042ef8ac06e91bdc67fd2cf2ecf0796caa3fb83 100644 (file)
@@ -69,7 +69,9 @@ void SUIT_PYTHON::init_python(int argc, char **argv)
   script += "del _custom_except_hook, sys\n";
   PyRun_SimpleString(qUtf8Printable(script));
   // VSR (22/09/2016): end of workaround
+#if PY_VERSION_HEX < 0x03070000
   PyEval_InitThreads(); // Create (and acquire) the interpreter lock - can be called many times
+#endif
   // Py_InitThreads acquires the GIL
   PyThreadState *pts = PyGILState_GetThisThreadState(); 
   PyEval_ReleaseThread(pts);
index 4620bb37392a2c84b0ca10e1054c002af3d63c35..6f0344630a54308ec02c555ee538b0859e813a9a 100644 (file)
@@ -273,7 +273,9 @@ void PyInterp_Interp::initPython()
     Py_Initialize(); // Initialize the interpreter
     PySys_SetArgv(_argc, changed_argv);
 
+#if PY_VERSION_HEX < 0x03070000
     PyEval_InitThreads(); // Create (and acquire) the Python global interpreter lock (GIL)
+#endif
     PyEval_SaveThread(); // release safely GIL
   }
 }