summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-03 00:00:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-03 00:00:18 (GMT)
commitc057c3859c68f2e86c7a492ae8f8b4b3a3b136c8 (patch)
treeb3002ee88ef675225cec5abe608ab934aefc6ae4 /Doc/library
parentb5e8e5755586820a278326e2aa55b8ff755f0a59 (diff)
downloadcpython-c057c3859c68f2e86c7a492ae8f8b4b3a3b136c8.zip
cpython-c057c3859c68f2e86c7a492ae8f8b4b3a3b136c8.tar.gz
cpython-c057c3859c68f2e86c7a492ae8f8b4b3a3b136c8.tar.bz2
Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
prevent corrupting exported buffer.
Diffstat (limited to 'Doc/library')
-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::