Salome HOME
PAL10715: Portability python 2.4. A fix by Erwan ADAM.
authorjfa <jfa@opencascade.com>
Fri, 2 Dec 2005 09:44:29 +0000 (09:44 +0000)
committerjfa <jfa@opencascade.com>
Fri, 2 Dec 2005 09:44:29 +0000 (09:44 +0000)
src/PyInterp/PyInterp_base.cxx
src/PyInterp/PyInterp_base.h
src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx

index e9fdcb2593f5955ad89734ad5aa7f3b7c3777290..a75c39bdd8ff54c794a5ce9044e8d7a366fd4bc0 100644 (file)
@@ -185,7 +185,7 @@ int compile_command(const char *command,PyObject *context)
     return 1;
   }else{
     // Complete and correct text. We evaluate it.
-#ifndef WNT
+#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
     PyObjWrapper r(PyEval_EvalCode(v,context,context));
 #else
     PyObjWrapper r(PyEval_EvalCode((PyCodeObject *)(void *)v,context,context));
index 469c0f40934a60345442b9259778aa3993776c02..b2e0a0b261cdbf0ff8cfb6a2e8e036e09ccb06d3 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <Python.h>   // must be before qt includes ...
 
-#ifndef WNT
+#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
 extern "C" PyObject * PyEval_EvalCode(PyObject *co, PyObject *g, PyObject *l);
 #endif
 
index 12ede8810d8a632c4117e815aa326ce0787f4db2..dbde7b1d314909f7eb4f9b07f5ae5ba5c5c94116 100644 (file)
@@ -67,7 +67,11 @@ int SALOME_PYQT_PyInterp::run(const char *command)
     PyErr_Print();
     return -1;
   }
+#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
   PyObject *r = PyEval_EvalCode(code,_g,_g);
+#else
+  PyObject *r = PyEval_EvalCode((PyCodeObject*)code,_g,_g);
+#endif
   Py_DECREF(code);
   if(!r){
     // Une erreur s est produite a l execution