@@ -578,7 +578,8 @@ than raw I/O does.
578578.. class :: BytesIO([initial_bytes])
579579
580580 A stream implementation using an in-memory bytes buffer. It inherits
581- :class: `BufferedIOBase `.
581+ :class: `BufferedIOBase `. The buffer is discarded when the
582+ :meth: `~IOBase.close ` method is called.
582583
583584 The argument *initial_bytes * contains optional initial :class: `bytes ` data.
584585
@@ -599,14 +600,15 @@ than raw I/O does.
599600
600601 .. note ::
601602 As long as the view exists, the :class: `BytesIO ` object cannot be
602- resized.
603+ resized or closed .
603604
604605 .. versionadded :: 3.2
605606
606607 .. method :: getvalue()
607608
608609 Return :class: `bytes ` containing the entire contents of the buffer.
609610
611+
610612 .. method :: read1()
611613
612614 In :class: `BytesIO `, this is the same as :meth: `read `.
@@ -880,7 +882,8 @@ Text I/O
880882
881883.. class :: StringIO(initial_value='', newline='\\n')
882884
883- An in-memory stream for text I/O.
885+ An in-memory stream for text I/O. The text buffer is discarded when the
886+ :meth: `~IOBase.close ` method is called.
884887
885888 The initial value of the buffer (an empty string by default) can be set by
886889 providing *initial_value *. The *newline * argument works like that of
@@ -892,9 +895,7 @@ Text I/O
892895
893896 .. method :: getvalue()
894897
895- Return a ``str `` containing the entire contents of the buffer at any
896- time before the :class: `StringIO ` object's :meth: `close ` method is
897- called.
898+ Return a ``str `` containing the entire contents of the buffer.
898899
899900 Example usage::
900901
0 commit comments