]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-30718: Add information about text buffering (GH-32351)
authorslateny <46876382+slateny@users.noreply.github.com>
Wed, 20 Apr 2022 08:24:53 +0000 (01:24 -0700)
committerGitHub <noreply@github.com>
Wed, 20 Apr 2022 08:24:53 +0000 (17:24 +0900)
Doc/library/functions.rst

index eaa4d482ce3fc9100852078452c5ad729a9c6409..e6fd0bb5eeef9960a76f8b8b7a8b4699911dd4b2 100644 (file)
@@ -1165,7 +1165,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