Mercurial > cpython-lru_cache-weakref
diff Lib/email/parser.py @ 65734:e727cf354720
Properly close a temporary TextIOWrapper in 'email'.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Fri, 29 Oct 2010 23:08:13 +0000 |
| parents | 1a041f364916 |
| children | 63a6d35fcac8 5a71d41ea20a |
line wrap: on
line diff
--- a/Lib/email/parser.py Fri Oct 29 22:49:14 2010 +0000 +++ b/Lib/email/parser.py Fri Oct 29 23:08:13 2010 +0000 @@ -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):
