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

src/Container/Container_init_python.cxx
src/Container/SALOME_CPythonHelper.cxx

index 25607af34e1495dfa9a48592e02f8cf307f96560..4baf0d1e115753912f474923734ec53134655cf4 100644 (file)
@@ -202,8 +202,9 @@ void KERNEL_PYTHON::init_python(int argc, char **argv)
   script += "del _custom_except_hook, sys\n";
   PyRun_SimpleString(script.c_str());
   // VSR (22/09/2016): end of workaround
+#if PY_VERSION_HEX < 0x03070000
   PyEval_InitThreads(); // Create (and acquire) the interpreter lock
-
+#endif
   // Create python objects to capture stdout and stderr
   PyObject* _vout=(PyObject*)ContainerNewPyStdOut( false ); // stdout
   PyObject* _verr=(PyObject*)ContainerNewPyStdOut( true );  // stderr
index b677d4fa941269204d11a18f968d8e8998724e2e..d6b5585e9ae31ef3f9adf36f9f0a225ac059c5a7 100644 (file)
@@ -36,7 +36,9 @@ Py_DecodeLocale(const char *arg, size_t *size)
 void SALOME_CPythonHelper::initializePython(int argc, char *argv[])
 {
   Py_Initialize();
+#if PY_VERSION_HEX < 0x03070000
   PyEval_InitThreads();
+#endif
   wchar_t **changed_argv = new wchar_t*[argc]; // Setting arguments
   for (int i = 0; i < argc; i++)
     changed_argv[i] = Py_DecodeLocale(argv[i], NULL);