[Python-3000-checkins] r55334 - in python/branches/p3yk: Doc/lib/libos.tex Lib/os.py

neal.norwitz python-3000-checkins at python.org
Tue May 15 02:11:16 CEST 2007


Author: neal.norwitz
Date: Tue May 15 02:11:10 2007
New Revision: 55334

Modified:
   python/branches/p3yk/Doc/lib/libos.tex
   python/branches/p3yk/Lib/os.py
Log:
Remove popen* functions from os

Modified: python/branches/p3yk/Doc/lib/libos.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libos.tex	(original)
+++ python/branches/p3yk/Doc/lib/libos.tex	Tue May 15 02:11:10 2007
@@ -378,68 +378,6 @@
 Availability: Macintosh, \UNIX, Windows.
 \end{funcdesc}
 
-There are a number of different \function{popen*()} functions that
-provide slightly different ways to create subprocesses.
-\deprecated{2.6}{All of the \function{popen*()} functions are obsolete.
-                 Use the \module{subprocess} module.}
-
-For each of the \function{popen*()} variants, if \var{bufsize} is
-specified, it specifies the buffer size for the I/O pipes.
-\var{mode}, if provided, should be the string \code{'b'} or
-\code{'t'}; on Windows this is needed to determine whether the file
-objects should be opened in binary or text mode.  The default value
-for \var{mode} is \code{'t'}.
-
-Also, for each of these variants, on \UNIX, \var{cmd} may be a sequence, in
-which case arguments will be passed directly to the program without shell
-intervention (as with \function{os.spawnv()}). If \var{cmd} is a string it will
-be passed to the shell (as with \function{os.system()}).
-
-These methods do not make it possible to retrieve the exit status from
-the child processes.  The only way to control the input and output
-streams and also retrieve the return codes is to use the
-\refmodule{subprocess} module; these are only available on \UNIX.
-
-For a discussion of possible deadlock conditions related to the use
-of these functions, see ``\ulink{Flow Control
-Issues}{popen2-flow-control.html}''
-(section~\ref{popen2-flow-control}).
-
-\begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}}
-Executes \var{cmd} as a sub-process.  Returns the file objects
-\code{(\var{child_stdin}, \var{child_stdout})}.
-\deprecated{2.6}{All of the \function{popen*()} functions are obsolete.
-                 Use the \module{subprocess} module.}
-Availability: Macintosh, \UNIX, Windows.
-\versionadded{2.0}
-\end{funcdesc}
-
-\begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}}
-Executes \var{cmd} as a sub-process.  Returns the file objects
-\code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}.
-\deprecated{2.6}{All of the \function{popen*()} functions are obsolete.
-                 Use the \module{subprocess} module.}
-Availability: Macintosh, \UNIX, Windows.
-\versionadded{2.0}
-\end{funcdesc}
-
-\begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}}
-Executes \var{cmd} as a sub-process.  Returns the file objects
-\code{(\var{child_stdin}, \var{child_stdout_and_stderr})}.
-\deprecated{2.6}{All of the \function{popen*()} functions are obsolete.
-                 Use the \module{subprocess} module.}
-Availability: Macintosh, \UNIX, Windows.
-\versionadded{2.0}
-\end{funcdesc}
-
-(Note that \code{\var{child_stdin}, \var{child_stdout}, and
-\var{child_stderr}} are named from the point of view of the child
-process, so \var{child_stdin} is the child's standard input.)
-
-This functionality is also available in the \refmodule{popen2} module
-using functions of the same names, but the return values of those
-functions have a different order.
-
 
 \subsection{File Descriptor Operations \label{os-fd-ops}}
 

Modified: python/branches/p3yk/Lib/os.py
==============================================================================
--- python/branches/p3yk/Lib/os.py	(original)
+++ python/branches/p3yk/Lib/os.py	Tue May 15 02:11:10 2007
@@ -653,68 +653,6 @@
 
     __all__.extend(["spawnvp", "spawnvpe", "spawnlp", "spawnlpe",])
 
-
-# Supply popen2 etc. (for Unix)
-if _exists("fork"):
-    if not _exists("popen2"):
-        def popen2(cmd, mode="t", bufsize=-1):
-            """Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
-            may be a sequence, in which case arguments will be passed directly to
-            the program without shell intervention (as with os.spawnv()).  If 'cmd'
-            is a string it will be passed to the shell (as with os.system()). If
-            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
-            file objects (child_stdin, child_stdout) are returned."""
-            import warnings
-            msg = "os.popen2 is deprecated.  Use the subprocess module."
-            warnings.warn(msg, DeprecationWarning, stacklevel=2)
-
-            import subprocess
-            PIPE = subprocess.PIPE
-            p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                                 stdin=PIPE, stdout=PIPE, close_fds=True)
-            return p.stdin, p.stdout
-        __all__.append("popen2")
-
-    if not _exists("popen3"):
-        def popen3(cmd, mode="t", bufsize=-1):
-            """Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
-            may be a sequence, in which case arguments will be passed directly to
-            the program without shell intervention (as with os.spawnv()).  If 'cmd'
-            is a string it will be passed to the shell (as with os.system()). If
-            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
-            file objects (child_stdin, child_stdout, child_stderr) are returned."""
-            import warnings
-            msg = "os.popen3 is deprecated.  Use the subprocess module."
-            warnings.warn(msg, DeprecationWarning, stacklevel=2)
-
-            import subprocess
-            PIPE = subprocess.PIPE
-            p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                                 stdin=PIPE, stdout=PIPE, stderr=PIPE,
-                                 close_fds=True)
-            return p.stdin, p.stdout, p.stderr
-        __all__.append("popen3")
-
-    if not _exists("popen4"):
-        def popen4(cmd, mode="t", bufsize=-1):
-            """Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
-            may be a sequence, in which case arguments will be passed directly to
-            the program without shell intervention (as with os.spawnv()).  If 'cmd'
-            is a string it will be passed to the shell (as with os.system()). If
-            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
-            file objects (child_stdin, child_stdout_stderr) are returned."""
-            import warnings
-            msg = "os.popen4 is deprecated.  Use the subprocess module."
-            warnings.warn(msg, DeprecationWarning, stacklevel=2)
-
-            import subprocess
-            PIPE = subprocess.PIPE
-            p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
-                                 stdin=PIPE, stdout=PIPE,
-                                 stderr=subprocess.STDOUT, close_fds=True)
-            return p.stdin, p.stdout
-        __all__.append("popen4")
-
 import copy_reg as _copy_reg
 
 def _make_stat_result(tup, dict):


More information about the Python-3000-checkins mailing list