diff options
author | Inada Naoki <songofacandy@gmail.com> | 2022-04-30 06:53:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 06:53:29 (GMT) |
commit | 354ace8b07e7d445fd2de713b6af1271536adce0 (patch) | |
tree | 6827337429f78065731f6136975b4bea47dd8e0d /Doc | |
parent | c7b7f12b8609f932a23a9bc96a5de7cd9ecd5723 (diff) | |
download | cpython-354ace8b07e7d445fd2de713b6af1271536adce0.zip cpython-354ace8b07e7d445fd2de713b6af1271536adce0.tar.gz cpython-354ace8b07e7d445fd2de713b6af1271536adce0.tar.bz2 |
gh-91954: Emit EncodingWarning from locale and subprocess (GH-91977)
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/subprocess.rst | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index fca5549..6a334ac 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -619,7 +619,7 @@ functions. If *encoding* or *errors* are specified, or *text* is true, the file objects *stdin*, *stdout* and *stderr* are opened in text mode with the specified - encoding and *errors*, as described above in :ref:`frequently-used-arguments`. + *encoding* and *errors*, as described above in :ref:`frequently-used-arguments`. The *universal_newlines* argument is equivalent to *text* and is provided for backwards compatibility. By default, file objects are opened in binary mode. @@ -1445,12 +1445,13 @@ This module also provides the following legacy functions from the 2.x none of the guarantees described above regarding security and exception handling consistency are valid for these functions. -.. function:: getstatusoutput(cmd) +.. function:: getstatusoutput(cmd, *, encoding=None, errors=None) Return ``(exitcode, output)`` of executing *cmd* in a shell. Execute the string *cmd* in a shell with :meth:`Popen.check_output` and - return a 2-tuple ``(exitcode, output)``. The locale encoding is used; + return a 2-tuple ``(exitcode, output)``. + *encoding* and *errors* are used to decode output; see the notes on :ref:`frequently-used-arguments` for more details. A trailing newline is stripped from the output. @@ -1475,8 +1476,10 @@ handling consistency are valid for these functions. as it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:`~Popen.returncode`. + .. versionadded:: 3.11 + Added *encoding* and *errors* arguments. -.. function:: getoutput(cmd) +.. function:: getoutput(cmd, *, encoding=None, errors=None) Return output (stdout and stderr) of executing *cmd* in a shell. @@ -1491,6 +1494,9 @@ handling consistency are valid for these functions. .. versionchanged:: 3.3.4 Windows support added + .. versionadded:: 3.11 + Added *encoding* and *errors* arguments. + Notes ----- |