Skip to content

Commit

Permalink
Merged revisions 55328-55341 via svnmerge from
Browse files Browse the repository at this point in the history
svn+ssh://[email protected]/python/branches/p3yk

........
  r55329 | brett.cannon | 2007-05-14 16:36:56 -0700 (Mon, 14 May 2007) | 3 lines

  Implement the removal of tuple parameter unpacking (PEP 3113).
  Thanks, Tony Lownds for the patch.
........
  r55331 | neal.norwitz | 2007-05-14 16:40:30 -0700 (Mon, 14 May 2007) | 1 line

  Update to use Python 3.0
........
  r55332 | brett.cannon | 2007-05-14 16:47:18 -0700 (Mon, 14 May 2007) | 2 lines

  Mention PEP 3113.  And thanks to Tony Lownds for the PEP 3113 patch.
........
  r55333 | neal.norwitz | 2007-05-14 16:57:06 -0700 (Mon, 14 May 2007) | 1 line

  Fix exception printing (no more exceptions module)
........
  r55334 | neal.norwitz | 2007-05-14 17:11:10 -0700 (Mon, 14 May 2007) | 1 line

  Remove popen* functions from os
........
  r55335 | neal.norwitz | 2007-05-14 18:03:38 -0700 (Mon, 14 May 2007) | 1 line

  Get rid of most of popen.  There are still some uses I need to cleanup.
........
  r55336 | neal.norwitz | 2007-05-14 21:11:34 -0700 (Mon, 14 May 2007) | 1 line

  Remove a few more remnants of the compiler package
........
  r55337 | neal.norwitz | 2007-05-14 22:28:27 -0700 (Mon, 14 May 2007) | 1 line

  Get test_[cx]pickle working on 64-bit platforms (avoid overflow int/long)
........
  • Loading branch information
gvanrossum committed May 15, 2007
1 parent 360e4b8 commit 1bc535d
Show file tree
Hide file tree
Showing 64 changed files with 1,459 additions and 2,687 deletions.
1 change: 0 additions & 1 deletion Doc/Makefile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \
lib/libimaplib.tex \
lib/libpoplib.tex \
lib/libcalendar.tex \
lib/libpopen2.tex \
lib/libbisect.tex \
lib/libcollections.tex \
lib/libheapq.tex \
Expand Down
1 change: 0 additions & 1 deletion Doc/lib/lib.tex
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ \chapter*{Front Matter\label{front}}
\input{libsubprocess}
\input{libsocket}
\input{libsignal}
\input{libpopen2}
\input{libasyncore}
\input{libasynchat}

Expand Down
2 changes: 1 addition & 1 deletion Doc/lib/libitertools.tex
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ \subsection{Examples \label{itertools-example}}
# is differencing with a range so that consecutive numbers all appear in
# same group.
>>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28]
>>> for k, g in groupby(enumerate(data), lambda (i,x):i-x):
>>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]):
... print map(operator.itemgetter(1), g)
...
[1]
Expand Down
65 changes: 0 additions & 65 deletions Doc/lib/libos.tex
Original file line number Diff line number Diff line change
Expand Up @@ -378,68 +378,6 @@ \subsection{File Object Creation \label{os-newstreams}}
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}}

Expand Down Expand Up @@ -1575,9 +1513,6 @@ \subsection{Process Management \label{os-process}}
\end{funcdesc}

\begin{funcdescni}{popen}{\unspecified}
\funclineni{popen2}{\unspecified}
\funclineni{popen3}{\unspecified}
\funclineni{popen4}{\unspecified}
Run child processes, returning opened pipes for communications. These
functions are described in section \ref{os-newstreams}.
\end{funcdescni}
Expand Down
190 changes: 0 additions & 190 deletions Doc/lib/libpopen2.tex

This file was deleted.

67 changes: 0 additions & 67 deletions Doc/lib/libsubprocess.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ \section{\module{subprocess} --- Subprocess management}
\begin{verbatim}
os.system
os.spawn*
os.popen*
popen2.*
commands.*
\end{verbatim}

Expand Down Expand Up @@ -335,68 +333,3 @@ \subsubsection{Replacing os.popen*}
==>
pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin
\end{verbatim}

\begin{verbatim}
(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)
==>
p = Popen(cmd, shell=True, bufsize=bufsize,
stdin=PIPE, stdout=PIPE, close_fds=True)
(child_stdin, child_stdout) = (p.stdin, p.stdout)
\end{verbatim}

\begin{verbatim}
(child_stdin,
child_stdout,
child_stderr) = os.popen3(cmd, mode, bufsize)
==>
p = Popen(cmd, shell=True, bufsize=bufsize,
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
\end{verbatim}

\begin{verbatim}
(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)
==>
p = Popen(cmd, shell=True, bufsize=bufsize,
stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
\end{verbatim}

\subsubsection{Replacing popen2.*}

\note{If the cmd argument to popen2 functions is a string, the command
is executed through /bin/sh. If it is a list, the command is directly
executed.}

\begin{verbatim}
(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode)
==>
p = Popen(["somestring"], shell=True, bufsize=bufsize,
stdin=PIPE, stdout=PIPE, close_fds=True)
(child_stdout, child_stdin) = (p.stdout, p.stdin)
\end{verbatim}

\begin{verbatim}
(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode)
==>
p = Popen(["mycmd", "myarg"], bufsize=bufsize,
stdin=PIPE, stdout=PIPE, close_fds=True)
(child_stdout, child_stdin) = (p.stdout, p.stdin)
\end{verbatim}

The popen2.Popen3 and popen2.Popen4 basically works as subprocess.Popen,
except that:

\begin{itemize}
\item subprocess.Popen raises an exception if the execution fails

\item the \var{capturestderr} argument is replaced with the \var{stderr}
argument.

\item stdin=PIPE and stdout=PIPE must be specified.

\item popen2 closes all file descriptors by default, but you have to
specify close_fds=True with subprocess.Popen.
\end{itemize}
5 changes: 3 additions & 2 deletions Doc/ref/ref3.tex
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ \section{The standard type hierarchy\label{types}}
\lineiii{__closure__}{\code{None} or a tuple of cells that contain
bindings for the function's free variables.}{Read-only}

\lineiii{__annotations__}{A dict containing annotations of parameters.}
{Writable}
\lineiii{__annotations__}{A dict containing annotations of parameters.
The keys of the dict are the parameter names, or \code{'return'}
for the return annotation, if provided.}{Writable}

\lineiii{__kwdefaults__}{A dict containing defaults for keyword-only
parameters.}{Writable}
Expand Down
Loading

0 comments on commit 1bc535d

Please sign in to comment.