diff options
Diffstat (limited to 'Tools/scripts/cleanfuture.py')
-rwxr-xr-x | Tools/scripts/cleanfuture.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Tools/scripts/cleanfuture.py b/Tools/scripts/cleanfuture.py index b48ab60dd6..94f6912632 100755 --- a/Tools/scripts/cleanfuture.py +++ b/Tools/scripts/cleanfuture.py @@ -96,11 +96,11 @@ def check(file): errprint("%r: I/O Error: %s" % (file, str(msg))) return - ff = FutureFinder(f, file) - changed = ff.run() - if changed: - ff.gettherest() - f.close() + with f: + ff = FutureFinder(f, file) + changed = ff.run() + if changed: + ff.gettherest() if changed: if verbose: print("changed.") @@ -122,9 +122,8 @@ def check(file): os.rename(file, bak) if verbose: print("renamed", file, "to", bak) - g = open(file, "w") - ff.write(g) - g.close() + with open(file, "w") as g: + ff.write(g) if verbose: print("wrote new", file) else: |