summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst13
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index b8dc688..3adf6e9 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -563,7 +563,8 @@ than raw I/O does.
.. class:: BytesIO([initial_bytes])
A stream implementation using an in-memory bytes buffer. It inherits
- :class:`BufferedIOBase`.
+ :class:`BufferedIOBase`. The buffer is discarded when the
+ :meth:`~IOBase.close` method is called.
The argument *initial_bytes* contains optional initial :class:`bytes` data.
@@ -584,7 +585,7 @@ than raw I/O does.
.. note::
As long as the view exists, the :class:`BytesIO` object cannot be
- resized.
+ resized or closed.
.. versionadded:: 3.2
@@ -592,6 +593,7 @@ than raw I/O does.
Return :class:`bytes` containing the entire contents of the buffer.
+
.. method:: read1()
In :class:`BytesIO`, this is the same as :meth:`read`.
@@ -858,7 +860,8 @@ Text I/O
.. class:: StringIO(initial_value='', newline='\\n')
- An in-memory stream for text I/O.
+ An in-memory stream for text I/O. The text buffer is discarded when the
+ :meth:`~IOBase.close` method is called.
The initial value of the buffer (an empty string by default) can be set by
providing *initial_value*. The *newline* argument works like that of
@@ -870,9 +873,7 @@ Text I/O
.. method:: getvalue()
- Return a ``str`` containing the entire contents of the buffer at any
- time before the :class:`StringIO` object's :meth:`close` method is
- called.
+ Return a ``str`` containing the entire contents of the buffer.
Example usage::