From: vsr Date: Fri, 23 Aug 2019 11:16:33 +0000 (+0300) Subject: Fix runtime warning about unclosed file descriptors X-Git-Tag: V9_4_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5c79f0146531d2db562b5adc1ba626cf8582488;p=tools%2Fmedcoupling.git Fix runtime warning about unclosed file descriptors --- 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()) %}