From: jfa Date: Fri, 2 Dec 2005 09:41:02 +0000 (+0000) Subject: PAL10715: Portability python 2.4. A fix by Erwan ADAM. X-Git-Tag: T_2_2_7pre~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f3295ac1982869c8e0b53e82c67d803634d02d5f;p=modules%2Fkernel.git PAL10715: Portability python 2.4. A fix by Erwan ADAM. --- diff --git a/src/SALOMEGUI/PyInterp_PyQt.cxx b/src/SALOMEGUI/PyInterp_PyQt.cxx index 29077ca0e..97e2775ea 100644 --- a/src/SALOMEGUI/PyInterp_PyQt.cxx +++ b/src/SALOMEGUI/PyInterp_PyQt.cxx @@ -65,7 +65,11 @@ void PyInterp_PyQt::run(const char *command) PyErr_Print(); return; } +#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 diff --git a/src/SALOMEGUI/PyInterp_base.cxx b/src/SALOMEGUI/PyInterp_base.cxx index 1c4879d1d..ff714a5f4 100644 --- a/src/SALOMEGUI/PyInterp_base.cxx +++ b/src/SALOMEGUI/PyInterp_base.cxx @@ -240,7 +240,11 @@ int compile_command(const char *command,PyObject *context) return 1; }else{ // Complete and correct text. We evaluate it. +#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)); +#endif if(!r){ // Execution error. We return -1 PyErr_Print(); diff --git a/src/SALOMEGUI/PyInterp_base.h b/src/SALOMEGUI/PyInterp_base.h index 739b5d4f0..6d7b2e4c9 100644 --- a/src/SALOMEGUI/PyInterp_base.h +++ b/src/SALOMEGUI/PyInterp_base.h @@ -24,7 +24,9 @@ class QSemaphore; class QMutex; +#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0 extern "C" PyObject * PyEval_EvalCode(PyObject *co, PyObject *g, PyObject *l); +#endif #define TOP_HISTORY_PY "--- top of history ---" #define BEGIN_HISTORY_PY "--- begin of history ---"