Cleanup findnocoding.py and pysource.py scripts (with infile/infile.close)
diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py
index 7348a68..69e8e0d 100755
--- a/Tools/scripts/pysource.py
+++ b/Tools/scripts/pysource.py
@@ -55,8 +55,8 @@
if infile is None:
return False
- line = infile.readline()
- infile.close()
+ with infile:
+ line = infile.readline()
if binary_re.search(line):
# file appears to be binary
@@ -76,8 +76,8 @@
if infile is None:
return False
- code = infile.read()
- infile.close()
+ with infile:
+ code = infile.read()
try:
compile(code, fullpath, "exec")