diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2016-07-07 18:53:34 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2016-07-07 18:53:34 +0300 |
commit | e8a8be5788fcf761d61d2e584e25a7d08b93cc95 (patch) | |
tree | 5f458c979197ef94c9a4a73dd4b04ec5db1de508 /utils/check_sources.py | |
parent | 593708a39cda458386b6c7352bebb62df6191af7 (diff) | |
download | sphinx-git-e8a8be5788fcf761d61d2e584e25a7d08b93cc95.tar.gz |
Handle more file closing with "with"
Diffstat (limited to 'utils/check_sources.py')
-rwxr-xr-x | utils/check_sources.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/utils/check_sources.py b/utils/check_sources.py index 16bc918cb..18d444057 100755 --- a/utils/check_sources.py +++ b/utils/check_sources.py @@ -223,11 +223,8 @@ def main(argv): print("Checking %s..." % fn) try: - f = open(fn, 'rb') - try: + with open(fn, 'rb') as f: lines = list(f) - finally: - f.close() except (IOError, OSError) as err: print("%s: cannot open: %s" % (fn, err)) num += 1 |