diff options
author | Éric Araujo <merwok@netwok.org> | 2010-11-05 23:51:56 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2010-11-05 23:51:56 (GMT) |
commit | bee5cef7dbff40734c347da5b93797e8db9103e8 (patch) | |
tree | 06dcc726207cfad3016f2b0f7c365fb9fe5b3cc6 /Lib/distutils/command/bdist_wininst.py | |
parent | afb078dd2673d919ac3733104757c441f256f30f (diff) | |
download | cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.zip cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.gz cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.bz2 |
Always close files in distutils code and tests (#10252).
Diffstat (limited to 'Lib/distutils/command/bdist_wininst.py')
-rw-r--r-- | Lib/distutils/command/bdist_wininst.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 3aa1dac..b2e2fc6 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -340,4 +340,8 @@ class bdist_wininst(Command): sfix = '' filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix)) - return open(filename, "rb").read() + f = open(filename, "rb") + try: + return f.read() + finally: + f.close() |