From: ageay Date: Tue, 16 Nov 2010 10:14:01 +0000 (+0000) Subject: Correction of downcast bug. X-Git-Tag: V5_1_5rc3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be281ad6820e9d8b8ce309cb53ee272d58c70ccc;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; }