diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-01-25 19:43:56 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-01-25 19:43:56 +0200 |
commit | c0b0bb6e01f7ea6a1a857609e794842223c4aa5c (patch) | |
tree | 23a00341a5a15f7af05ecd0549eb729dd906788a /Lib/mailcap.py | |
parent | #20348: fix headers markup in Argument Clinic howto. Patch by Moritz Neeb. (diff) | |
parent | Issue #20331: Fixed possible FD leaks in various modules: (diff) | |
download | cpython-c0b0bb6e01f7ea6a1a857609e794842223c4aa5c.tar.gz cpython-c0b0bb6e01f7ea6a1a857609e794842223c4aa5c.tar.bz2 cpython-c0b0bb6e01f7ea6a1a857609e794842223c4aa5c.zip |
Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
Diffstat (limited to 'Lib/mailcap.py')
-rw-r--r-- | Lib/mailcap.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/mailcap.py b/Lib/mailcap.py index bd61b0b0ae9..97e303522ca 100644 --- a/Lib/mailcap.py +++ b/Lib/mailcap.py @@ -22,8 +22,8 @@ def getcaps(): fp = open(mailcap, 'r') except OSError: 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 |