Skip to content

Commit 4757b7b

Browse files
authored
Drop references to popen[234] in subprocess docs
These functions were removed in Python 3. Signed-off-by: Bradley Reynolds <[email protected]>
1 parent d384813 commit 4757b7b

File tree

1 file changed

+2
-68
lines changed

1 file changed

+2
-68
lines changed

Doc/library/subprocess.rst

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,36 +1415,8 @@ Environment example::
14151415

14161416

14171417

1418-
Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`
1419-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1420-
1421-
::
1422-
1423-
(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)
1424-
==>
1425-
p = Popen(cmd, shell=True, bufsize=bufsize,
1426-
stdin=PIPE, stdout=PIPE, close_fds=True)
1427-
(child_stdin, child_stdout) = (p.stdin, p.stdout)
1428-
1429-
::
1430-
1431-
(child_stdin,
1432-
child_stdout,
1433-
child_stderr) = os.popen3(cmd, mode, bufsize)
1434-
==>
1435-
p = Popen(cmd, shell=True, bufsize=bufsize,
1436-
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
1437-
(child_stdin,
1438-
child_stdout,
1439-
child_stderr) = (p.stdin, p.stdout, p.stderr)
1440-
1441-
::
1442-
1443-
(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)
1444-
==>
1445-
p = Popen(cmd, shell=True, bufsize=bufsize,
1446-
stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
1447-
(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
1418+
Replacing :func:`os.popen`
1419+
^^^^^^^^^^^^^^^^^^^^^^^^^^
14481420

14491421
Return code handling translates as follows::
14501422

@@ -1461,44 +1433,6 @@ Return code handling translates as follows::
14611433
print("There were some errors")
14621434

14631435

1464-
Replacing functions from the :mod:`popen2` module
1465-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1466-
1467-
.. note::
1468-
1469-
If the cmd argument to popen2 functions is a string, the command is executed
1470-
through /bin/sh. If it is a list, the command is directly executed.
1471-
1472-
::
1473-
1474-
(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode)
1475-
==>
1476-
p = Popen("somestring", shell=True, bufsize=bufsize,
1477-
stdin=PIPE, stdout=PIPE, close_fds=True)
1478-
(child_stdout, child_stdin) = (p.stdout, p.stdin)
1479-
1480-
::
1481-
1482-
(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode)
1483-
==>
1484-
p = Popen(["mycmd", "myarg"], bufsize=bufsize,
1485-
stdin=PIPE, stdout=PIPE, close_fds=True)
1486-
(child_stdout, child_stdin) = (p.stdout, p.stdin)
1487-
1488-
:class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as
1489-
:class:`subprocess.Popen`, except that:
1490-
1491-
* :class:`Popen` raises an exception if the execution fails.
1492-
1493-
* The *capturestderr* argument is replaced with the *stderr* argument.
1494-
1495-
* ``stdin=PIPE`` and ``stdout=PIPE`` must be specified.
1496-
1497-
* popen2 closes all file descriptors by default, but you have to specify
1498-
``close_fds=True`` with :class:`Popen` to guarantee this behavior on
1499-
all platforms or past Python versions.
1500-
1501-
15021436
Legacy Shell Invocation Functions
15031437
---------------------------------
15041438

0 commit comments

Comments
 (0)