diff options
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 99ccf44..b89557d 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -216,7 +216,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, 'r').read() in g, l + f = open(script_name) + try: + exec f.read() in g, l + finally: + f.close() finally: sys.argv = save_argv _setup_stop_after = None |