Skip to content

Commit 88bbc5d

Browse files
bpo-30718: Add information about text buffering (GH-32351)
(cherry picked from commit 5101d97) Co-authored-by: slateny <[email protected]>
1 parent 942ea19 commit 88bbc5d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/functions.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,11 @@ are always available. They are listed here in alphabetical order.
11681168
*buffering* is an optional integer used to set the buffering policy. Pass 0
11691169
to switch buffering off (only allowed in binary mode), 1 to select line
11701170
buffering (only usable in text mode), and an integer > 1 to indicate the size
1171-
in bytes of a fixed-size chunk buffer. When no *buffering* argument is
1171+
in bytes of a fixed-size chunk buffer. Note that specifying a buffer size this
1172+
way applies for binary buffered I/O, but ``TextIOWrapper`` (i.e., files opened
1173+
with ``mode='r+'``) would have another buffering. To disable buffering in
1174+
``TextIOWrapper``, consider using the ``write_through`` flag for
1175+
:func:`io.TextIOWrapper.reconfigure`. When no *buffering* argument is
11721176
given, the default buffering policy works as follows:
11731177

11741178
* Binary files are buffered in fixed-size chunks; the size of the buffer is

0 commit comments

Comments
 (0)