Skip to content

Commit 027adf4

Browse files
slatenygpshead
andauthored
gh-47937: Note that Popen attributes are read-only (#93070)
* Note that Popen attributes aren't meant to be set by users by rewording the text about the attributes. * Also update some universal_newlines references to mention the modern text parameter name while in the area. Co-authored-by: Gregory P. Smith <[email protected]>
1 parent a9f0144 commit 027adf4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Doc/library/subprocess.rst

+12-11
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ functions.
457457
- :const:`0` means unbuffered (read and write are one
458458
system call and can return short)
459459
- :const:`1` means line buffered
460-
(only usable if ``universal_newlines=True`` i.e., in a text mode)
460+
(only usable if ``text=True`` or ``universal_newlines=True``)
461461
- any other positive value means use a buffer of approximately that
462462
size
463463
- negative bufsize (the default) means the system default of
@@ -847,7 +847,8 @@ Instances of the :class:`Popen` class have the following methods:
847847
On Windows :meth:`kill` is an alias for :meth:`terminate`.
848848

849849

850-
The following attributes are also available:
850+
The following attributes are also set by the class for you to access.
851+
Reassigning them to new values is unsupported:
851852

852853
.. attribute:: Popen.args
853854

@@ -860,29 +861,29 @@ The following attributes are also available:
860861

861862
If the *stdin* argument was :data:`PIPE`, this attribute is a writeable
862863
stream object as returned by :func:`open`. If the *encoding* or *errors*
863-
arguments were specified or the *universal_newlines* argument was ``True``,
864-
the stream is a text stream, otherwise it is a byte stream. If the *stdin*
865-
argument was not :data:`PIPE`, this attribute is ``None``.
864+
arguments were specified or the *text* or *universal_newlines* argument
865+
was ``True``, the stream is a text stream, otherwise it is a byte stream.
866+
If the *stdin* argument was not :data:`PIPE`, this attribute is ``None``.
866867

867868

868869
.. attribute:: Popen.stdout
869870

870871
If the *stdout* argument was :data:`PIPE`, this attribute is a readable
871872
stream object as returned by :func:`open`. Reading from the stream provides
872873
output from the child process. If the *encoding* or *errors* arguments were
873-
specified or the *universal_newlines* argument was ``True``, the stream is a
874-
text stream, otherwise it is a byte stream. If the *stdout* argument was not
875-
:data:`PIPE`, this attribute is ``None``.
874+
specified or the *text* or *universal_newlines* argument was ``True``, the
875+
stream is a text stream, otherwise it is a byte stream. If the *stdout*
876+
argument was not :data:`PIPE`, this attribute is ``None``.
876877

877878

878879
.. attribute:: Popen.stderr
879880

880881
If the *stderr* argument was :data:`PIPE`, this attribute is a readable
881882
stream object as returned by :func:`open`. Reading from the stream provides
882883
error output from the child process. If the *encoding* or *errors* arguments
883-
were specified or the *universal_newlines* argument was ``True``, the stream
884-
is a text stream, otherwise it is a byte stream. If the *stderr* argument was
885-
not :data:`PIPE`, this attribute is ``None``.
884+
were specified or the *text* or *universal_newlines* argument was ``True``, the
885+
stream is a text stream, otherwise it is a byte stream. If the *stderr* argument
886+
was not :data:`PIPE`, this attribute is ``None``.
886887

887888
.. warning::
888889

0 commit comments

Comments
 (0)