mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Handle more file closing with "with"
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user