Salome HOME
updated copyright message
[modules/kernel.git] / src / Container / Container_init_python.cxx
index ff5e639ad66b7694fa38bcd9af6be72cb34f352c..93f54ac044c8beba8968ca30861e11047b01db54 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -73,7 +73,7 @@ ContainerPyStdOut_write(ContainerPyStdOut *self, PyObject *args)
 }
 
 static PyObject*
-ContainerPyStdOut_flush(ContainerPyStdOut *self)
+ContainerPyStdOut_flush(ContainerPyStdOut */*self*/, PyObject */*args*/)
 {
   Py_INCREF(Py_None);
   return Py_None;
@@ -82,13 +82,12 @@ ContainerPyStdOut_flush(ContainerPyStdOut *self)
 static PyMethodDef ContainerPyStdOut_methods[] = {
   {"write",  (PyCFunction)ContainerPyStdOut_write,  METH_VARARGS, PyDoc_STR("write(string) -> None")},
   {"flush",  (PyCFunction)ContainerPyStdOut_flush,  METH_NOARGS,  PyDoc_STR("flush() -> None")},
-  {NULL,    NULL}   /* sentinel */
+  {0, 0, 0, 0} /* sentinel */
 };
 
 static PyMemberDef ContainerPyStdOut_memberlist[] = {
-      {(char*)"softspace", T_INT,  offsetof(ContainerPyStdOut, softspace), 0,
-       (char*)"flag indicating that a space needs to be printed; used by print"},
-      {NULL} /* Sentinel */
+  {(char*)"softspace", T_INT,  offsetof(ContainerPyStdOut, softspace), 0, (char*)"flag indicating that a space needs to be printed; used by print"},
+  {0, 0, 0, 0, 0} /* sentinel */
 };
 
 static PyTypeObject ContainerPyStdOut_Type = {
@@ -171,7 +170,6 @@ void KERNEL_PYTHON::init_python(int argc, char **argv)
   MESSAGE("=================================================================");
   // set stdout to line buffering (aka C++ std::cout)
   setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
-  wchar_t* salome_python;
   char* env_python=getenv("SALOME_PYTHON");
   if(env_python != 0)
     {
@@ -202,10 +200,11 @@ void KERNEL_PYTHON::init_python(int argc, char **argv)
   script += "import sys\n";
   script += "sys.excepthook = _custom_except_hook\n";
   script += "del _custom_except_hook, sys\n";
-  int res = PyRun_SimpleString(script.c_str());
+  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