[Python-checkins] cpython (2.7): Issue #13237: remove some details that only apply to the 3.x version of this
nick.coghlan
python-checkins at python.org
Wed Oct 26 13:16:05 CEST 2011
http://hg.python.org/cpython/rev/f445c125aca3
changeset: 73132:f445c125aca3
branch: 2.7
user: Nick Coghlan <ncoghlan at gmail.com>
date: Wed Oct 26 21:15:53 2011 +1000
summary:
Issue #13237: remove some details that only apply to the 3.x version of this module and cross reference the relocated warning about the dangers of invoking the shell with untrusted input
files:
Doc/library/subprocess.rst | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -101,9 +101,6 @@
Examples::
>>> subprocess.check_output(["echo", "Hello World!"])
- b'Hello World!\n'
-
- >>> subprocess.check_output(["echo", "Hello World!"], universal_newlines=True)
'Hello World!\n'
>>> subprocess.check_output("exit 1", shell=True)
@@ -111,13 +108,6 @@
...
subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1
- By default, this function will return the data as encoded bytes. The actual
- encoding of the output data may depend on the command being invoked, so the
- decoding to text will often need to be handled at the application level.
-
- This behaviour may be overridden by setting *universal_newlines* to
- :const:`True` as described below in :ref:`frequently-used-arguments`.
-
To also capture standard error in the result, use
``stderr=subprocess.STDOUT``::
@@ -179,10 +169,8 @@
handle as for stdout.
When *stdout* or *stderr* are pipes and *universal_newlines* is
- :const:`True` then the output data is assumed to be encoded as UTF-8 and
- will automatically be decoded to text. All line endings will be converted
- to ``'\n'`` as described for the universal newlines `'U'`` mode argument
- to :func:`open`.
+ :const:`True` then all line endings will be converted to ``'\n'`` as
+ described for the universal newlines `'U'`` mode argument to :func:`open`.
If *shell* is :const:`True`, the specified command will be executed through
the shell. This can be useful if you are using Python primarily for the
@@ -318,6 +306,12 @@
If *shell* is :const:`True`, the specified command will be executed through the
shell.
+ .. note::
+
+ Enabling this option can be a security hazard if combined with untrusted
+ input. See the warning under :ref:`frequently-used-arguments`
+ for details.
+
If *cwd* is not ``None``, the child's current directory will be changed to *cwd*
before it is executed. Note that this directory is not considered when
searching the executable, so you can't specify the program's path relative to
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list