mirror of
https://github.com/python/cpython.git
synced 2025-09-17 06:06:25 +00:00
raise an ValueError in getvalue() on closed StringIO (closes #12161)
Thanks for Catalin Iacob for the patch.
This commit is contained in:
parent
dbfba1667c
commit
4fa68ab10b
4 changed files with 9 additions and 0 deletions
|
@ -266,6 +266,7 @@ class StringIO:
|
|||
8th bit) will cause a UnicodeError to be raised when getvalue()
|
||||
is called.
|
||||
"""
|
||||
_complain_ifclosed(self.closed)
|
||||
if self.buflist:
|
||||
self.buf += ''.join(self.buflist)
|
||||
self.buflist = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue