diff options
author | Brett Cannon <bcannon@gmail.com> | 2010-10-29 23:08:13 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2010-10-29 23:08:13 (GMT) |
commit | 06407b35b16cdd141a1cc6fdc122762add855279 (patch) | |
tree | 69cfe88d009a3e245ff638bc0531a7904fad805b /Lib/email | |
parent | c0eee315f5ea3efa6143f4b976ad2be80e3f182f (diff) | |
download | cpython-06407b35b16cdd141a1cc6fdc122762add855279.zip cpython-06407b35b16cdd141a1cc6fdc122762add855279.tar.gz cpython-06407b35b16cdd141a1cc6fdc122762add855279.tar.bz2 |
Properly close a temporary TextIOWrapper in 'email'.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/parser.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/parser.py b/Lib/email/parser.py index b83e0f7..6caaff5 100644 --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -120,7 +120,8 @@ class BytesParser: meaning it parses the entire contents of the file. """ fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape') - return self.parser.parse(fp, headersonly) + with fp: + return self.parser.parse(fp, headersonly) def parsebytes(self, text, headersonly=False): |