From dedd15b6a4edeb3d3c4c5b6faaa9c2534c572280 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 12 May 2022 13:43:01 +0300 Subject: [PATCH] bos #29863 [CEA 29586] MEDCouplingBascisTest failing: SWIG 4 compatibility (temporary solution) --- CMakeLists.txt | 8 ++++++++ src/MEDCoupling_Swig/MEDCouplingRefCountObject.i | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 842dd4aee..8064b103d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,6 +211,14 @@ IF(MEDCOUPLING_ENABLE_PYTHON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") MESSAGE(STATUS "Using Python 3") ENDIF() + IF ("${SWIG_VERSION}" VERSION_GREATER_EQUAL "4") + SET(MEDCOUPLING_SWIG4_COMPAT TRUE CACHE BOOL "SWIG 4 compatibility (experimental)") + ELSE() + SET(MEDCOUPLING_SWIG4_COMPAT FALSE) + ENDIF() + IF(MEDCOUPLING_SWIG4_COMPAT) + LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT") + ENDIF() ENDIF(MEDCOUPLING_ENABLE_PYTHON) IF(MEDCOUPLING_BUILD_DOC) diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index cae752fff..7e363eaf3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -47,7 +47,11 @@ namespace INTERP_KERNEL catch (INTERP_KERNEL::Exception& _e) { // Reraise with SWIG_Python_Raise SWIG_Python_Raise(SWIG_NewPointerObj((new INTERP_KERNEL::Exception(static_cast< const INTERP_KERNEL::Exception& >(_e))),SWIGTYPE_p_INTERP_KERNEL__Exception,SWIG_POINTER_OWN), "INTERP_KERNEL::Exception", SWIGTYPE_p_INTERP_KERNEL__Exception); +#ifdef MEDCOUPLING_SWIG4_COMPAT + return nullptr; +#else SWIG_fail; +#endif } } -- 2.39.2