summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-12-21 00:59:53 (GMT)
committerGitHub <noreply@github.com>2017-12-21 00:59:53 (GMT)
commit507434fd504f3ebc1da72aa77544edc0d73f136e (patch)
tree521c4ca2eeff16a7cee8594cbca095d9bdec9181 /Doc/library
parent31e99080f6f8cf7faaba9fe3a4e0996e49163317 (diff)
downloadcpython-507434fd504f3ebc1da72aa77544edc0d73f136e.zip
cpython-507434fd504f3ebc1da72aa77544edc0d73f136e.tar.gz
cpython-507434fd504f3ebc1da72aa77544edc0d73f136e.tar.bz2
bpo-15216: io: TextIOWrapper.reconfigure() accepts encoding, errors and newline (GH-2343)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/io.rst18
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 6778058..5c71d90 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -904,7 +904,7 @@ Text I/O
locale encoding using :func:`locale.setlocale`, use the current locale
encoding instead of the user preferred encoding.
- :class:`TextIOWrapper` provides one attribute in addition to those of
+ :class:`TextIOWrapper` provides these members in addition to those of
:class:`TextIOBase` and its parents:
.. attribute:: line_buffering
@@ -918,11 +918,19 @@ Text I/O
.. versionadded:: 3.7
- .. method:: reconfigure(*, line_buffering=None, write_through=None)
+ .. method:: reconfigure(*[, encoding][, errors][, newline][, \
+ line_buffering][, write_through])
- Reconfigure this text stream using new settings for *line_buffering*
- and *write_through*. Passing ``None`` as an argument will retain
- the current setting for that parameter.
+ Reconfigure this text stream using new settings for *encoding*,
+ *errors*, *newline*, *line_buffering* and *write_through*.
+
+ Parameters not specified keep current settings, except
+ ``errors='strict`` is used when *encoding* is specified but
+ *errors* is not specified.
+
+ It is not possible to change the encoding or newline if some data
+ has already been read from the stream. On the other hand, changing
+ encoding after write is possible.
This method does an implicit stream flush before setting the
new parameters.