]> granicus.if.org Git - python/commitdiff
Properly close a temporary TextIOWrapper in 'email'.
authorBrett Cannon <bcannon@gmail.com>
Fri, 29 Oct 2010 23:08:13 +0000 (23:08 +0000)
committerBrett Cannon <bcannon@gmail.com>
Fri, 29 Oct 2010 23:08:13 +0000 (23:08 +0000)
Lib/email/parser.py

index b83e0f7e6b54f6b4a118f0fe133789097acee006..6caaff53ad40897b6fbc3c024e8365679dfc7fea 100644 (file)
@@ -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):