mirror of https://github.com/python/cpython
Properly close a temporary TextIOWrapper in 'email'.
This commit is contained in:
parent
c0eee315f5
commit
06407b35b1
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue