From: ageay Date: Tue, 16 Nov 2010 10:14:01 +0000 (+0000) Subject: Correction of downcast bug. X-Git-Tag: V5_1_5^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=63de6bd0d2ebf5178917e848324893dc10956bc1;p=tools%2Fmedcoupling.git Correction of downcast bug. --- diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index b5d9b2a29..d1af65ba8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -23,11 +23,18 @@ static PyObject* convertMesh(ParaMEDMEM::MEDCouplingMesh* mesh, int owner) { - PyObject *ret; + PyObject *ret=0; if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingExtrudedMesh,owner); + if(dynamic_cast(mesh)) + ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh,owner); + if(!ret) + { + PyErr_SetString(PyExc_TypeError,"Not recognized type of mesh on downcast !"); + PyErr_Print(); + } return ret; }