mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
This commit is contained in:
parent
933209689e
commit
91b0bc237c
5 changed files with 34 additions and 30 deletions
|
@ -22,8 +22,8 @@ def getcaps():
|
|||
fp = open(mailcap, 'r')
|
||||
except IOError:
|
||||
continue
|
||||
morecaps = readmailcapfile(fp)
|
||||
fp.close()
|
||||
with fp:
|
||||
morecaps = readmailcapfile(fp)
|
||||
for key, value in morecaps.items():
|
||||
if not key in caps:
|
||||
caps[key] = value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue