diff options
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): |