From: jfa Date: Fri, 2 Dec 2005 09:44:29 +0000 (+0000) Subject: PAL10715: Portability python 2.4. A fix by Erwan ADAM. X-Git-Tag: BR_3_1_0_deb~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ef80e381721faf3fabac937a63e724e310f7ff8a;p=modules%2Fgui.git PAL10715: Portability python 2.4. A fix by Erwan ADAM. --- diff --git a/src/PyInterp/PyInterp_base.cxx b/src/PyInterp/PyInterp_base.cxx index e9fdcb259..a75c39bdd 100644 --- a/src/PyInterp/PyInterp_base.cxx +++ b/src/PyInterp/PyInterp_base.cxx @@ -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)); diff --git a/src/PyInterp/PyInterp_base.h b/src/PyInterp/PyInterp_base.h index 469c0f409..b2e0a0b26 100644 --- a/src/PyInterp/PyInterp_base.h +++ b/src/PyInterp/PyInterp_base.h @@ -24,7 +24,7 @@ #include // 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 diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx index 12ede8810..dbde7b1d3 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx @@ -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