From 2e724b84e0051b3e8303f95e402093425544eb50 Mon Sep 17 00:00:00 2001 From: slateny <46876382+slateny@users.noreply.github.com> Date: Sun, 22 May 2022 03:55:20 -0700 Subject: [PATCH 1/3] Note that Popen attributes are read-only --- Doc/library/subprocess.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 4031a5f62167f0..9c9990491f20bc 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -839,7 +839,7 @@ Instances of the :class:`Popen` class have the following methods: On Windows :meth:`kill` is an alias for :meth:`terminate`. -The following attributes are also available: +The following read-only attributes are also available: .. attribute:: Popen.args From 55d46ef077cc7338ac5a5ca61905a4ff181e4c7a Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Tue, 7 Feb 2023 23:57:32 -0800 Subject: [PATCH 2/3] Reword the test about the attributes. --- Doc/library/subprocess.rst | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 9c9990491f20bc..6b7a93f743d99d 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -839,7 +839,8 @@ Instances of the :class:`Popen` class have the following methods: On Windows :meth:`kill` is an alias for :meth:`terminate`. -The following read-only attributes are also available: +The following attributes are also set by the class for you to access. +Reassigning them to new values is unsupported: .. attribute:: Popen.args @@ -852,9 +853,9 @@ The following read-only attributes are also available: If the *stdin* argument was :data:`PIPE`, this attribute is a writeable stream object as returned by :func:`open`. If the *encoding* or *errors* - arguments were specified or the *universal_newlines* argument was ``True``, - the stream is a text stream, otherwise it is a byte stream. If the *stdin* - argument was not :data:`PIPE`, this attribute is ``None``. + arguments were specified or the *text* or *universal_newlines* argument + was ``True``, the stream is a text stream, otherwise it is a byte stream. + If the *stdin* argument was not :data:`PIPE`, this attribute is ``None``. .. attribute:: Popen.stdout @@ -862,9 +863,9 @@ The following read-only attributes are also available: If the *stdout* argument was :data:`PIPE`, this attribute is a readable stream object as returned by :func:`open`. Reading from the stream provides output from the child process. If the *encoding* or *errors* arguments were - specified or the *universal_newlines* argument was ``True``, the stream is a - text stream, otherwise it is a byte stream. If the *stdout* argument was not - :data:`PIPE`, this attribute is ``None``. + specified or the *text* or *universal_newlines* argument was ``True``, the + stream is a text stream, otherwise it is a byte stream. If the *stdout* + argument was not :data:`PIPE`, this attribute is ``None``. .. attribute:: Popen.stderr @@ -872,9 +873,9 @@ The following read-only attributes are also available: If the *stderr* argument was :data:`PIPE`, this attribute is a readable stream object as returned by :func:`open`. Reading from the stream provides error output from the child process. If the *encoding* or *errors* arguments - were specified or the *universal_newlines* argument was ``True``, the stream - is a text stream, otherwise it is a byte stream. If the *stderr* argument was - not :data:`PIPE`, this attribute is ``None``. + were specified or the *text* or *universal_newlines* argument was ``True``, the + stream is a text stream, otherwise it is a byte stream. If the *stderr* argument + was not :data:`PIPE`, this attribute is ``None``. .. warning:: From f36513737d1dc12a1d8bcb53fa885958ed3e4ba0 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Wed, 8 Feb 2023 00:07:25 -0800 Subject: [PATCH 3/3] update another old universal_newlines reference to mention text. --- Doc/library/subprocess.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 6b7a93f743d99d..937db90308ece0 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -450,7 +450,7 @@ functions. - :const:`0` means unbuffered (read and write are one system call and can return short) - :const:`1` means line buffered - (only usable if ``universal_newlines=True`` i.e., in a text mode) + (only usable if ``text=True`` or ``universal_newlines=True``) - any other positive value means use a buffer of approximately that size - negative bufsize (the default) means the system default of