bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index 3ab56fd..83aa508 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -142,7 +142,8 @@
# last option can not be "-i", so this ensures "pos+1" is in range!
if sys.argv[pos] == '-i':
try:
- options = open(sys.argv[pos+1]).read().split()
+ with open(sys.argv[pos+1]) as infp:
+ options = infp.read().split()
except IOError as why:
usage("File name '%s' specified with the -i option "
"can not be read - %s" % (sys.argv[pos+1], why) )