From: ageay Date: Thu, 21 Jun 2012 15:02:30 +0000 (+0000) Subject: Clean of swig on throw. X-Git-Tag: V6_main_FINAL~627 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=56c4c7e674bba816d85f976138d2cbd3973baf8f;p=tools%2Fmedcoupling.git Clean of swig on throw. --- diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 042016e48..7481d6809 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -5871,6 +5871,7 @@ namespace ParaMEDMEM self->getValueOn(spaceLoc,time,res); return convertDblArrToPyList(res,sz); } + void setValues(PyObject *li) throw(INTERP_KERNEL::Exception) { if(self->getArray()!=0) @@ -5882,8 +5883,9 @@ namespace ParaMEDMEM self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo); } else - PyErr_SetString(PyExc_TypeError,"setValuesCpy : field must contain an array behind"); + throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind"); } + PyObject *getTime() throw(INTERP_KERNEL::Exception) { int tmp1,tmp2; diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 4cc947b02..20f6de0c3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -31,11 +31,7 @@ static PyObject* convertMesh(ParaMEDMEM::MEDCouplingMesh* mesh, int owner) throw if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh,owner); if(!ret) - { - const char msg[]="Not recognized type of mesh on downcast !"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("Not recognized type of mesh on downcast !"); return ret; } @@ -120,9 +116,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL else { delete [] tmp; - const char msg[]="list must contain integers only"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception("list must contain integers only"); } } return tmp; @@ -142,9 +136,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL else { delete [] tmp; - const char msg[]="tuple must contain integers only"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception("tuple must contain integers only"); } } return tmp; @@ -152,9 +144,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL else { #ifndef WITH_NUMPY2 - const char msg[]="convertPyToNewIntArr2 : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception("convertPyToNewIntArr2 : not a list"); #else if(PyArray_Check(pyLi)) { @@ -165,9 +155,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL } else { - const char msg[]="convertPyToNewIntArr2 : not a list nor PyArray"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception("convertPyToNewIntArr2 : not a list nor PyArray"); } #endif } @@ -245,11 +233,7 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) throw(I arr[i]=val; } else - { - const char msg[]="list must contain integers only"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("list must contain integers only"); } } else if(PyTuple_Check(pyLi)) @@ -265,19 +249,13 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) throw(I arr[i]=val; } else - { - const char msg[]="tuple must contain integers only"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("tuple must contain integers only"); } } else { #ifndef WITH_NUMPY2 - const char msg[]="convertPyToNewIntArr3 : not a list nor a tuple"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception("convertPyToNewIntArr3 : not a list nor a tuple"); #else if(PyArray_Check(pyLi)) { @@ -288,11 +266,7 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) throw(I return ; } else - { - const char msg[]="convertPyToNewIntArr3 : not a list nor a tuple nor PyArray"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyToNewIntArr3 : not a list nor a tuple nor PyArray"); #endif } } @@ -344,22 +318,14 @@ static void fillArrayWithPyListInt(PyObject *pyLi, int *arrToFill, int sizeOfArr arrToFill[i]=val; } else - { - const char msg[]="tuple must contain integers only"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("tuple must contain integers only"); } for(int i=size;i& v) throw(INTERP_KERNEL::Exception) @@ -550,21 +496,13 @@ void convertPyObjToVecUMeshesCst(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecUMeshesCst : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecUMeshesCst : not a list"); } void convertPyObjToVecUMeshes(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) @@ -579,21 +517,13 @@ void convertPyObjToVecUMeshes(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecUMeshes : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecUMeshes : not a list"); } void convertPyObjToVecMeshesCst(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) @@ -608,21 +538,13 @@ void convertPyObjToVecMeshesCst(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecUMeshesCst : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecUMeshesCst : not a list"); } void convertPyObjToVecDataArrayDblCst(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) @@ -637,21 +559,13 @@ void convertPyObjToVecDataArrayDblCst(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecDataArrayDblCst : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecDataArrayDblCst : not a list"); } void convertPyObjToVecFieldDblCst(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) @@ -666,21 +580,13 @@ void convertPyObjToVecFieldDblCst(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecFieldDblCst : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecFieldDblCst : not a list"); } void convertPyObjToVecDataArrayIntCst(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) @@ -695,21 +601,13 @@ void convertPyObjToVecDataArrayIntCst(PyObject *ms, std::vector(argp); v[i]=arg; } } else - { - const char msg[]="convertPyObjToVecDataArrayInt : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } + throw INTERP_KERNEL::Exception("convertPyObjToVecDataArrayInt : not a list"); } /*!