Merged revisions 85497 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85497 | antoine.pitrou | 2010-10-14 23:15:17 +0200 (jeu., 14 oct. 2010) | 3 lines

  Explicitly close some files (from issue #10093)
........
This commit is contained in:
Antoine Pitrou 2010-10-14 21:22:52 +00:00
parent b67660fcce
commit f7c24450be
5 changed files with 25 additions and 14 deletions

View file

@ -199,9 +199,8 @@ class MimeTypes:
list of standard types, else to the list of non-standard
types.
"""
fp = open(filename)
self.readfp(fp, strict)
fp.close()
with open(filename) as fp:
self.readfp(fp, strict)
def readfp(self, fp, strict=True):
"""
@ -356,7 +355,7 @@ def init(files=None):
files = knownfiles
for file in files:
if os.path.isfile(file):
db.readfp(open(file))
db.read(file)
encodings_map = db.encodings_map
suffix_map = db.suffix_map
types_map = db.types_map[True]