[Python-checkins] r85947 - python/branches/py3k/Lib/email/parser.py

brett.cannon python-checkins at python.org
Sat Oct 30 01:08:13 CEST 2010


Author: brett.cannon
Date: Sat Oct 30 01:08:13 2010
New Revision: 85947

Log:
Properly close a temporary TextIOWrapper in 'email'.


Modified:
   python/branches/py3k/Lib/email/parser.py

Modified: python/branches/py3k/Lib/email/parser.py
==============================================================================
--- python/branches/py3k/Lib/email/parser.py	(original)
+++ python/branches/py3k/Lib/email/parser.py	Sat Oct 30 01:08:13 2010
@@ -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):


More information about the Python-checkins mailing list