diff Lib/StringIO.py @ 70425:720804a91c01 2.7

raise an ValueError in getvalue() on closed StringIO (closes #12161) Thanks for Catalin Iacob for the patch.
author Benjamin Peterson <benjamin@python.org>
date Thu, 26 May 2011 09:56:41 -0500
parents b36cb4602e21
children 7513bd184a01
line wrap: on
line diff
--- a/Lib/StringIO.py	Thu May 26 13:37:25 2011 +0200
+++ b/Lib/StringIO.py	Thu May 26 09:56:41 2011 -0500
@@ -266,6 +266,7 @@
         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 = []