From 3a8f78681a3987c319bdebbf3561588bc87e8f87 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 7 Jun 2005 08:26:19 +0000 Subject: [PATCH] portability python 2.4 --- src/SALOMEGUI/PyInterp_PyQt.cxx | 4 ++++ src/SALOMEGUI/PyInterp_base.cxx | 5 +++++ src/SALOMEGUI/PyInterp_base.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/SALOMEGUI/PyInterp_PyQt.cxx b/src/SALOMEGUI/PyInterp_PyQt.cxx index 29077ca0e..96fc200d8 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 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..df63d7315 100644 --- a/src/SALOMEGUI/PyInterp_base.cxx +++ b/src/SALOMEGUI/PyInterp_base.cxx @@ -240,7 +240,12 @@ int compile_command(const char *command,PyObject *context) return 1; }else{ // Complete and correct text. We evaluate it. +#if PY_VERSION_HEX < 0x02040000 PyObjWrapper r(PyEval_EvalCode(v,context,context)); +#else + PyCodeObject* vv = (PyCodeObject*)(v.get()); + PyObjWrapper r(PyEval_EvalCode(vv,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..3f73b38f2 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 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 ---" -- 2.39.2