[Python-checkins] distutils2: Remove one overlooked with statement
eric.araujo
python-checkins at python.org
Wed Oct 19 21:08:00 CEST 2011
http://hg.python.org/distutils2/rev/e469b70fc25e
changeset: 1217:e469b70fc25e
user: Éric Araujo <merwok at netwok.org>
date: Wed Oct 19 05:58:37 2011 +0200
summary:
Remove one overlooked with statement
files:
distutils2/compiler/msvc9compiler.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/distutils2/compiler/msvc9compiler.py b/distutils2/compiler/msvc9compiler.py
--- a/distutils2/compiler/msvc9compiler.py
+++ b/distutils2/compiler/msvc9compiler.py
@@ -650,8 +650,11 @@
# runtimes are not in WinSxS folder, but in Python's own
# folder), the runtimes do not need to be in every folder
# with .pyd's.
- with open(manifest_file) as manifest_f:
+ manifest_f = open(manifest_file)
+ try:
manifest_buf = manifest_f.read()
+ finally:
+ manifest_f.close()
pattern = re.compile(
r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
@@ -659,8 +662,11 @@
manifest_buf = re.sub(pattern, "", manifest_buf)
pattern = "<dependentAssembly>\s*</dependentAssembly>"
manifest_buf = re.sub(pattern, "", manifest_buf)
- with open(manifest_file, 'w') as manifest_f:
+ manifest_f = open(manifest_file, 'w')
+ try:
manifest_f.write(manifest_buf)
+ finally:
+ manifest_f.close()
except IOError:
pass
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list