commit | 06407b35b16cdd141a1cc6fdc122762add855279 | [log] [tgz] |
---|---|---|
author | Brett Cannon <bcannon@gmail.com> | Fri Oct 29 23:08:13 2010 +0000 |
committer | Brett Cannon <bcannon@gmail.com> | Fri Oct 29 23:08:13 2010 +0000 |
tree | 69cfe88d009a3e245ff638bc0531a7904fad805b | |
parent | c0eee315f5ea3efa6143f4b976ad2be80e3f182f [diff] [blame] |
Properly close a temporary TextIOWrapper in 'email'.
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 @@ 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):