Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d5ec134

Browse files
committed
Issue #13597: Fix the documentation of the "-u" command-line option, and wording of "What's new in Python 3.0" about standard streams.
2 parents de911b2 + 08c08eb commit d5ec134

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

Doc/using/cmdline.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ Miscellaneous options
249249

250250
Force the binary layer of the stdin, stdout and stderr streams (which is
251251
available as their ``buffer`` attribute) to be unbuffered. The text I/O
252-
layer will still be line-buffered.
252+
layer will still be line-buffered if writing to the console, or
253+
block-buffered if redirected to a non-interactive file.
253254

254255
See also :envvar:`PYTHONUNBUFFERED`.
255256

Doc/whatsnew/3.0.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ changed.
301301
There is no longer any need for using the encoding-aware streams
302302
in the :mod:`codecs` module.
303303

304+
* The initial values of :data:`sys.stdin`, :data:`sys.stdout` and
305+
:data:`sys.stderr` are now unicode-only text files (i.e., they are
306+
instances of :class:`io.TextIOBase`). To read and write bytes data
307+
with these streams, you need to use their :data:`io.TextIOBase.buffer`
308+
attribute.
309+
304310
* Filenames are passed to and returned from APIs as (Unicode) strings.
305311
This can present platform-specific problems because on some
306312
platforms filenames are arbitrary byte strings. (On the other hand,
@@ -511,9 +517,7 @@ consulted for longer descriptions.
511517
produces a literal of type :class:`bytes`.
512518

513519
* :ref:`pep-3116`. The :mod:`io` module is now the standard way of
514-
doing file I/O, and the initial values of :data:`sys.stdin`,
515-
:data:`sys.stdout` and :data:`sys.stderr` are now instances of
516-
:class:`io.TextIOBase`. The built-in :func:`open` function is now an
520+
doing file I/O. The built-in :func:`open` function is now an
517521
alias for :func:`io.open` and has additional keyword arguments
518522
*encoding*, *errors*, *newline* and *closefd*. Also note that an
519523
invalid *mode* argument now raises :exc:`ValueError`, not

0 commit comments

Comments
 (0)