mirror of
https://github.com/python/cpython.git
synced 2025-10-02 13:22:19 +00:00
bpo-32815: Improve docs on the subprocess API *text* parameter (GH-5622) (GH-5631)
Describe *text* as an alias for *universal_newlines* in more places that people are likely to be referred to.
(cherry picked from commit e14c010378
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
09df4b761f
commit
ba4f218657
1 changed files with 15 additions and 8 deletions
|
@ -39,7 +39,7 @@ compatibility with older versions, see the :ref:`call-function-trio` section.
|
||||||
|
|
||||||
.. function:: run(args, *, stdin=None, input=None, stdout=None, stderr=None,\
|
.. function:: run(args, *, stdin=None, input=None, stdout=None, stderr=None,\
|
||||||
shell=False, cwd=None, timeout=None, check=False, \
|
shell=False, cwd=None, timeout=None, check=False, \
|
||||||
encoding=None, errors=None)
|
encoding=None, errors=None, text=None)
|
||||||
|
|
||||||
Run the command described by *args*. Wait for command to complete, then
|
Run the command described by *args*. Wait for command to complete, then
|
||||||
return a :class:`CompletedProcess` instance.
|
return a :class:`CompletedProcess` instance.
|
||||||
|
@ -267,7 +267,8 @@ default values. The arguments that are most commonly needed are:
|
||||||
.. index::
|
.. index::
|
||||||
single: universal newlines; subprocess module
|
single: universal newlines; subprocess module
|
||||||
|
|
||||||
If *encoding* or *errors* are specified, or *universal_newlines* is true,
|
If *encoding* or *errors* are specified, or *text* (also known as
|
||||||
|
*universal_newlines*) is true,
|
||||||
the file objects *stdin*, *stdout* and *stderr* will be opened in text
|
the file objects *stdin*, *stdout* and *stderr* will be opened in text
|
||||||
mode using the *encoding* and *errors* specified in the call or the
|
mode using the *encoding* and *errors* specified in the call or the
|
||||||
defaults for :class:`io.TextIOWrapper`.
|
defaults for :class:`io.TextIOWrapper`.
|
||||||
|
@ -284,6 +285,9 @@ default values. The arguments that are most commonly needed are:
|
||||||
.. versionadded:: 3.6
|
.. versionadded:: 3.6
|
||||||
Added *encoding* and *errors* parameters.
|
Added *encoding* and *errors* parameters.
|
||||||
|
|
||||||
|
.. versionadded:: 3.7
|
||||||
|
Added the *text* parameter as an alias for *universal_newlines*.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The newlines attribute of the file objects :attr:`Popen.stdin`,
|
The newlines attribute of the file objects :attr:`Popen.stdin`,
|
||||||
|
@ -328,7 +332,7 @@ functions.
|
||||||
cwd=None, env=None, universal_newlines=False, \
|
cwd=None, env=None, universal_newlines=False, \
|
||||||
startupinfo=None, creationflags=0, restore_signals=True, \
|
startupinfo=None, creationflags=0, restore_signals=True, \
|
||||||
start_new_session=False, pass_fds=(), *, \
|
start_new_session=False, pass_fds=(), *, \
|
||||||
encoding=None, errors=None)
|
encoding=None, errors=None, text=None)
|
||||||
|
|
||||||
Execute a child program in a new process. On POSIX, the class uses
|
Execute a child program in a new process. On POSIX, the class uses
|
||||||
:meth:`os.execvp`-like behavior to execute the child program. On Windows,
|
:meth:`os.execvp`-like behavior to execute the child program. On Windows,
|
||||||
|
@ -511,15 +515,18 @@ functions.
|
||||||
|
|
||||||
.. _side-by-side assembly: https://en.wikipedia.org/wiki/Side-by-Side_Assembly
|
.. _side-by-side assembly: https://en.wikipedia.org/wiki/Side-by-Side_Assembly
|
||||||
|
|
||||||
If *encoding* or *errors* are specified, the file objects *stdin*, *stdout*
|
If *encoding* or *errors* are specified, or *text* is true, the file objects
|
||||||
and *stderr* are opened in text mode with the specified encoding and
|
*stdin*, *stdout* and *stderr* are opened in text mode with the specified
|
||||||
*errors*, as described above in :ref:`frequently-used-arguments`. If
|
encoding and *errors*, as described above in :ref:`frequently-used-arguments`.
|
||||||
*universal_newlines* is ``True``, they are opened in text mode with default
|
The *universal_newlines* argument is equivalent to *text* and is provided
|
||||||
encoding. Otherwise, they are opened as binary streams.
|
for backwards compatibility. By default, file objects are opened in binary mode.
|
||||||
|
|
||||||
.. versionadded:: 3.6
|
.. versionadded:: 3.6
|
||||||
*encoding* and *errors* were added.
|
*encoding* and *errors* were added.
|
||||||
|
|
||||||
|
.. versionadded:: 3.7
|
||||||
|
*text* was added as a more readable alias for *universal_newlines*.
|
||||||
|
|
||||||
If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is
|
If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is
|
||||||
passed to the underlying ``CreateProcess`` function.
|
passed to the underlying ``CreateProcess`` function.
|
||||||
*creationflags*, if given, can be one or more of the following flags:
|
*creationflags*, if given, can be one or more of the following flags:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue