From f5c79f0146531d2db562b5adc1ba626cf8582488 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 23 Aug 2019 14:16:33 +0300 Subject: [PATCH] Fix runtime warning about unclosed file descriptors --- src/MEDCoupling_Swig/MEDCouplingCommon.i | 4 ++-- src/RENUMBER_Swig/MEDRenumberCommon.i | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 5670b093b..61c79a2cc 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -5951,6 +5951,6 @@ MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFrom import os __filename=os.environ.get('PYTHONSTARTUP') if __filename and os.path.isfile(__filename): - exec(open(__filename).read()) - pass + with(open(__filename) as __fp): + exec(__fp.read()) %} diff --git a/src/RENUMBER_Swig/MEDRenumberCommon.i b/src/RENUMBER_Swig/MEDRenumberCommon.i index 2224e52f0..60a28d72e 100644 --- a/src/RENUMBER_Swig/MEDRenumberCommon.i +++ b/src/RENUMBER_Swig/MEDRenumberCommon.i @@ -68,6 +68,6 @@ using namespace INTERP_KERNEL; import os __filename=os.environ.get('PYTHONSTARTUP') if __filename and os.path.isfile(__filename): - exec(open(__filename).read()) - pass + with(open(__filename) as __fp): + exec(__fp.read()) %} -- 2.39.2