mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Always close files in distutils code and tests (#10252).
This commit is contained in:
parent
afb078dd26
commit
bee5cef7db
24 changed files with 261 additions and 171 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue