mirror of
https://github.com/python/cpython.git
synced 2025-10-18 04:38:07 +00:00
Properly close a temporary TextIOWrapper in 'email'.
This commit is contained in:
parent
c0eee315f5
commit
06407b35b1
1 changed files with 2 additions and 1 deletions
|
@ -120,6 +120,7 @@ class BytesParser:
|
||||||
meaning it parses the entire contents of the file.
|
meaning it parses the entire contents of the file.
|
||||||
"""
|
"""
|
||||||
fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape')
|
fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape')
|
||||||
|
with fp:
|
||||||
return self.parser.parse(fp, headersonly)
|
return self.parser.parse(fp, headersonly)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue