diff options
author | Éric Araujo <merwok@netwok.org> | 2010-11-06 02:58:56 +0000 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2010-11-06 02:58:56 +0000 |
commit | 623fc895d7dd7e0ce036699bc7e3be3421b81645 (patch) | |
tree | edc6a22765956a60ea2eee0d15345488045f9df8 /Lib/distutils/core.py | |
parent | a6fc2c6ef682aa391202774720222061208d01a3 (diff) | |
download | cpython-623fc895d7dd7e0ce036699bc7e3be3421b81645.tar.gz |
Merged revisions 86223-86224,86226,86234 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86223 | eric.araujo | 2010-11-06 00:51:56 +0100 (sam., 06 nov. 2010) | 2 lines
Always close files in distutils code and tests (#10252).
........
r86224 | eric.araujo | 2010-11-06 00:58:34 +0100 (sam., 06 nov. 2010) | 2 lines
Add missing entry for r86223.
........
r86226 | eric.araujo | 2010-11-06 00:59:32 +0100 (sam., 06 nov. 2010) | 2 lines
Of course, I forgot one file in r86223.
........
r86234 | eric.araujo | 2010-11-06 03:10:32 +0100 (sam., 06 nov. 2010) | 2 lines
Also close file descriptors from os.popen and subprocess.Popen
........
Diffstat (limited to 'Lib/distutils/core.py')
-rw-r--r-- | Lib/distutils/core.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index 6e4892039e..fd2a43d7d2 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -215,7 +215,11 @@ def run_setup (script_name, script_args=None, stop_after="run"): sys.argv[0] = script_name if script_args is not None: sys.argv[1:] = script_args - exec(open(script_name).read(), g, l) + f = open(script_name) + try: + exec(f.read(), g, l) + finally: + f.close() finally: sys.argv = save_argv _setup_stop_after = None |