[Python-checkins] bpo-30718: Add information about text buffering (GH-32351)

miss-islington webhook-mailer at python.org
Wed Apr 20 05:00:41 EDT 2022


https://github.com/python/cpython/commit/33c6feb811326e6f6d3487ed88df8dc66c552edc
commit: 33c6feb811326e6f6d3487ed88df8dc66c552edc
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-04-20T02:00:32-07:00
summary:

bpo-30718: Add information about text buffering (GH-32351)

(cherry picked from commit 5101d97d0b13425ccc5ed37abfabb07701db81fe)

Co-authored-by: slateny <46876382+slateny at users.noreply.github.com>

files:
M Doc/library/functions.rst

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 9a9c707dc177a..937e00bf994e6 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1113,7 +1113,11 @@ are always available.  They are listed here in alphabetical order.
    *buffering* is an optional integer used to set the buffering policy.  Pass 0
    to switch buffering off (only allowed in binary mode), 1 to select line
    buffering (only usable in text mode), and an integer > 1 to indicate the size
-   in bytes of a fixed-size chunk buffer.  When no *buffering* argument is
+   in bytes of a fixed-size chunk buffer. Note that specifying a buffer size this
+   way applies for binary buffered I/O, but ``TextIOWrapper`` (i.e., files opened
+   with ``mode='r+'``) would have another buffering. To disable buffering in
+   ``TextIOWrapper``, consider using the ``write_through`` flag for
+   :func:`io.TextIOWrapper.reconfigure`. When no *buffering* argument is
    given, the default buffering policy works as follows:
 
    * Binary files are buffered in fixed-size chunks; the size of the buffer is



More information about the Python-checkins mailing list