mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
This commit is contained in:
commit
c0b0bb6e01
5 changed files with 34 additions and 30 deletions
|
@ -363,9 +363,10 @@ def read_mime_types(file):
|
|||
f = open(file)
|
||||
except OSError:
|
||||
return None
|
||||
db = MimeTypes()
|
||||
db.readfp(f, True)
|
||||
return db.types_map[True]
|
||||
with f:
|
||||
db = MimeTypes()
|
||||
db.readfp(f, True)
|
||||
return db.types_map[True]
|
||||
|
||||
|
||||
def _default_mime_types():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue