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

Skip to content

Commit d1f9352

Browse files
committed
(Merge 3.2) open() / TextIOWrapper doc: make it explicit than newline='\n'
doesn't translate newlines on output.
2 parents 3c25dfb + 401e17d commit d1f9352

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

Doc/library/functions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,9 @@ are always available. They are listed here in alphabetical order.
887887

888888
* On output, if *newline* is ``None``, any ``'\n'`` characters written are
889889
translated to the system default line separator, :data:`os.linesep`. If
890-
*newline* is ``''``, no translation takes place. If *newline* is any of
891-
the other legal values, any ``'\n'`` characters written are translated to
892-
the given string.
890+
*newline* is ``''`` or ``'\n'``, no translation takes place. If *newline*
891+
is any of the other legal values, any ``'\n'`` characters written are
892+
translated to the given string.
893893

894894
If *closefd* is ``False`` and a file descriptor rather than a filename was
895895
given, the underlying file descriptor will be kept open when the file is

Doc/library/io.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,9 @@ Text I/O
780780

781781
* On output, if *newline* is ``None``, any ``'\n'`` characters written are
782782
translated to the system default line separator, :data:`os.linesep`. If
783-
*newline* is ``''``, no translation takes place. If *newline* is any of
784-
the other legal values, any ``'\n'`` characters written are translated to
785-
the given string.
783+
*newline* is ``''`` or ``'\n'``, no translation takes place. If *newline*
784+
is any of the other legal values, any ``'\n'`` characters written are
785+
translated to the given string.
786786

787787
If *line_buffering* is ``True``, :meth:`flush` is implied when a call to
788788
write contains a newline character.

Modules/_io/_iomodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ PyDoc_STRVAR(open_doc,
185185
"\n"
186186
"* On output, if newline is None, any '\\n' characters written are\n"
187187
" translated to the system default line separator, os.linesep. If\n"
188-
" newline is '', no translation takes place. If newline is any of the\n"
189-
" other legal values, any '\\n' characters written are translated to\n"
190-
" the given string.\n"
188+
" newline is '' or '\n', no translation takes place. If newline is any\n"
189+
" of the other legal values, any '\\n' characters written are translated\n"
190+
" to the given string.\n"
191191
"\n"
192192
"If closefd is False, the underlying file descriptor will be kept open\n"
193193
"when the file is closed. This does not work when a file name is given\n"

Modules/_io/textio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,9 @@ PyDoc_STRVAR(textiowrapper_doc,
648648
"\n"
649649
"* On output, if newline is None, any '\\n' characters written are\n"
650650
" translated to the system default line separator, os.linesep. If\n"
651-
" newline is '', no translation takes place. If newline is any of the\n"
652-
" other legal values, any '\\n' characters written are translated to\n"
653-
" the given string.\n"
651+
" newline is '' or '\n', no translation takes place. If newline is any\n"
652+
" of the other legal values, any '\\n' characters written are translated\n"
653+
" to the given string.\n"
654654
"\n"
655655
"If line_buffering is True, a call to flush is implied when a call to\n"
656656
"write contains a newline character."

0 commit comments

Comments
 (0)