[Python-checkins] r73561 - in python/branches/release26-maint: Doc/library/functions.rst Doc/library/os.rst Doc/library/subprocess.rst Doc/library/turtle.rst
r.david.murray
python-checkins at python.org
Thu Jun 25 19:40:52 CEST 2009
Author: r.david.murray
Date: Thu Jun 25 19:40:52 2009
New Revision: 73561
Log:
Merged revisions 73026,73313,73511,73554 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73026 | r.david.murray | 2009-05-29 15:30:27 -0400 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73313 | r.david.murray | 2009-06-08 20:44:22 -0400 (Mon, 08 Jun 2009) | 4 lines
Issue 2947: document how return code handling translates from
os.popen to subprocess. Also fixes reference link in the
os.spawn documentation.
........
r73511 | r.david.murray | 2009-06-22 18:11:04 -0400 (Mon, 22 Jun 2009) | 2 lines
Improve English phrasing.
........
r73554 | r.david.murray | 2009-06-25 10:21:06 -0400 (Thu, 25 Jun 2009) | 2 lines
Add a couple of missing function alias declarations to the turtle docs.
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Doc/library/functions.rst
python/branches/release26-maint/Doc/library/os.rst
python/branches/release26-maint/Doc/library/subprocess.rst
python/branches/release26-maint/Doc/library/turtle.rst
Modified: python/branches/release26-maint/Doc/library/functions.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/functions.rst (original)
+++ python/branches/release26-maint/Doc/library/functions.rst Thu Jun 25 19:40:52 2009
@@ -151,7 +151,7 @@
``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it
consists of a single expression, or ``'single'`` if it consists of a single
interactive statement (in the latter case, expression statements that
- evaluate to something else than ``None`` will be printed).
+ evaluate to something other than ``None`` will be printed).
The optional arguments *flags* and *dont_inherit* control which future
statements (see :pep:`236`) affect the compilation of *source*. If neither
Modified: python/branches/release26-maint/Doc/library/os.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/os.rst (original)
+++ python/branches/release26-maint/Doc/library/os.rst Thu Jun 25 19:40:52 2009
@@ -1710,8 +1710,8 @@
(Note that the :mod:`subprocess` module provides more powerful facilities for
spawning new processes and retrieving their results; using that module is
- preferable to using these functions. Check specially the *Replacing Older
- Functions with the subprocess Module* section in that documentation page.)
+ preferable to using these functions. Check especially the
+ :ref:`subprocess-replacements` section.)
If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new
process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it
Modified: python/branches/release26-maint/Doc/library/subprocess.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/subprocess.rst (original)
+++ python/branches/release26-maint/Doc/library/subprocess.rst Thu Jun 25 19:40:52 2009
@@ -39,9 +39,12 @@
Arguments are:
*args* should be a string, or a sequence of program arguments. The program
- to execute is normally the first item in the args sequence or the string if a
- string is given, but can be explicitly set by using the *executable*
- argument.
+ to execute is normally the first item in the args sequence or the string if
+ a string is given, but can be explicitly set by using the *executable*
+ argument. When *executable* is given, the first item in the args sequence
+ is still treated by most programs as the command name, which can then be
+ different from the actual executable name. On Unix, it becomes the display
+ name for the executing program in utilities such as :program:`ps`.
On Unix, with *shell=False* (default): In this case, the Popen class uses
:meth:`os.execvp` to execute the child program. *args* should normally be a
@@ -354,8 +357,8 @@
output = p2.communicate()[0]
-Replacing os.system()
-^^^^^^^^^^^^^^^^^^^^^
+Replacing :func:`os.system`
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
@@ -382,8 +385,8 @@
print >>sys.stderr, "Execution failed:", e
-Replacing the os.spawn family
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Replacing the :func:`os.spawn <os.spawnl>` family
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
P_NOWAIT example::
@@ -410,8 +413,8 @@
Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})
-Replacing os.popen, os.popen2, os.popen3
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
@@ -453,9 +456,23 @@
stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
+Return code handling translates as follows::
+
+ pipe = os.popen(cmd, 'w')
+ ...
+ rc = pipe.close()
+ if rc != None and rc % 256:
+ print "There were some errors"
+ ==>
+ process = Popen(cmd, 'w', stdin=PIPE)
+ ...
+ process.stdin.close()
+ if process.wait() != 0:
+ print "There were some errors"
+
-Replacing functions from the popen2 module
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Replacing functions from the :mod:`popen2` module
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note::
Modified: python/branches/release26-maint/Doc/library/turtle.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/turtle.rst (original)
+++ python/branches/release26-maint/Doc/library/turtle.rst Thu Jun 25 19:40:52 2009
@@ -1140,6 +1140,7 @@
.. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None)
+ turtlesize(stretch_wid=None, stretch_len=None, outline=None)
:param stretch_wid: positive number
:param stretch_len: positive number
@@ -1332,6 +1333,7 @@
.. function:: getturtle()
+ getpen()
Return the Turtle object itself. Only reasonable use: as a function to
return the "anonymous turtle":
More information about the Python-checkins
mailing list