Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21896a3

Browse files
committed
Merged revisions 77952,78030,78102,78104,78107,78206,78216,78296-78297,78328,78331-78332,78336,78339,78343,78378-78379,78415,78559,78717,78791 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r77952 | mark.dickinson | 2010-02-03 10:50:14 -0600 (Wed, 03 Feb 2010) | 1 line Fix test_inspect.py data to match recent change to inspect_fodder.py (r77942). ........ r78030 | benjamin.peterson | 2010-02-06 14:14:10 -0600 (Sat, 06 Feb 2010) | 1 line check type_getattro for correctness in a descriptor corner case ........ r78102 | andrew.kuchling | 2010-02-07 19:35:35 -0600 (Sun, 07 Feb 2010) | 1 line Move distutils into its own subsection; add various items ........ r78104 | andrew.kuchling | 2010-02-08 07:22:24 -0600 (Mon, 08 Feb 2010) | 1 line Add two items; move a subsection ........ r78107 | antoine.pitrou | 2010-02-08 14:25:47 -0600 (Mon, 08 Feb 2010) | 3 lines Clarify and correct description for ccbench and iobench. ........ r78206 | r.david.murray | 2010-02-16 11:55:26 -0600 (Tue, 16 Feb 2010) | 3 lines Make the references to Popen in the description of Call and check_call into links. ........ r78216 | andrew.kuchling | 2010-02-18 08:16:48 -0600 (Thu, 18 Feb 2010) | 1 line Add various items ........ r78296 | andrew.kuchling | 2010-02-21 20:08:45 -0600 (Sun, 21 Feb 2010) | 1 line Re-word ........ r78297 | andrew.kuchling | 2010-02-21 20:29:10 -0600 (Sun, 21 Feb 2010) | 1 line #7076: mention SystemRandom class near start of the module docs; reword change description for clarity. Noted by Shawn Ligocki. ........ r78328 | jack.diederich | 2010-02-22 12:17:16 -0600 (Mon, 22 Feb 2010) | 1 line fixes issue #7530, serve_forever() ........ r78331 | andrew.kuchling | 2010-02-22 12:38:23 -0600 (Mon, 22 Feb 2010) | 1 line Fix comment typo ........ r78332 | andrew.kuchling | 2010-02-22 12:42:07 -0600 (Mon, 22 Feb 2010) | 2 lines #7627: MH.remove() would fail if the MH mailbox was locked; it would call _unlock_file() and pass it a closed file object. Noted by Rob Austein. ........ r78336 | jack.diederich | 2010-02-22 13:55:22 -0600 (Mon, 22 Feb 2010) | 1 line fixes issue #1522237, bad init check in _threading_local ........ r78339 | jack.diederich | 2010-02-22 15:27:38 -0600 (Mon, 22 Feb 2010) | 1 line * fix issue#7476 ........ r78343 | andrew.kuchling | 2010-02-22 16:48:41 -0600 (Mon, 22 Feb 2010) | 10 lines #2560: remove an unnecessary 'for' loop from my_fgets() in Parser/myreadline.c. Noted by Joseph Armbruster; patch by Jessica McKellar. The original code was 'for (;;) {...}', where ... ended with a 'return -2' statement and did not contain a 'break' or 'continue' statement. Therefore, the body of the loop is always executed once. Once upon a time there was a 'continue' in the loop, but it was removed in rev36346, committed by mwh on Wed Jul 7 17:44:12 2004. ........ r78378 | jack.diederich | 2010-02-23 11:23:30 -0600 (Tue, 23 Feb 2010) | 1 line fixup markup error ........ r78379 | jack.diederich | 2010-02-23 13:34:06 -0600 (Tue, 23 Feb 2010) | 1 line issue#6442 use in operator instead of has_key ........ r78415 | dirkjan.ochtman | 2010-02-23 22:00:52 -0600 (Tue, 23 Feb 2010) | 1 line Issue #7733: add explicit reference in asyncore docs. ........ r78559 | andrew.kuchling | 2010-03-01 13:45:21 -0600 (Mon, 01 Mar 2010) | 1 line #7637: update discussion of minidom.unlink() and garbage collection ........ r78717 | benjamin.peterson | 2010-03-05 21:13:33 -0600 (Fri, 05 Mar 2010) | 1 line settscdump is definitely an implementation detail ........ r78791 | andrew.kuchling | 2010-03-08 06:00:39 -0600 (Mon, 08 Mar 2010) | 1 line Add various items ........
1 parent 7588b8b commit 21896a3

16 files changed

Lines changed: 106 additions & 92 deletions

Doc/distutils/sourcedist.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Notes:
5454
requires the :program:`compress` program. Notice that this format is now
5555
pending for deprecation and will be removed in the future versions of Python.
5656

57-
When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or ``tar``), you
58-
can specify under Unix the ``owner`` and ``group`` names that will be set for
59-
each member of the archive.
57+
When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or
58+
``tar``) under Unix, you can specify the ``owner`` and ``group`` names
59+
that will be set for each member of the archive.
6060

6161
For example, if you want all files of the archive to be owned by root::
6262

Doc/library/asyncore.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ any that have been added to the map during asynchronous service) is closed.
201201
.. method:: bind(address)
202202

203203
Bind the socket to *address*. The socket must not already be bound. (The
204-
format of *address* depends on the address family --- see above.) To mark
204+
format of *address* depends on the address family --- refer to the
205+
:mod:`socket` documentation for more information.) To mark
205206
the socket as re-usable (setting the :const:`SO_REUSEADDR` option), call
206207
the :class:`dispatcher` object's :meth:`set_reuse_addr` method.
207208

Doc/library/multiprocessing.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ their parent process exits. The manager classes are defined in the
11311131

11321132
Create a BaseManager object.
11331133

1134-
Once created one should call :meth:`start` or :meth:`serve_forever` to ensure
1134+
Once created one should call :meth:`start` or ``get_server().serve_forever()`` to ensure
11351135
that the manager object refers to a started manager process.
11361136

11371137
*address* is the address on which the manager process listens for new
@@ -1147,10 +1147,6 @@ their parent process exits. The manager classes are defined in the
11471147
Start a subprocess to start the manager. If *initializer* is not ``None``
11481148
then the subprocess will call ``initializer(*initargs)`` when it starts.
11491149

1150-
.. method:: serve_forever()
1151-
1152-
Run the server in the current process.
1153-
11541150
.. method:: get_server()
11551151

11561152
Returns a :class:`Server` object which represents the actual server under

Doc/library/random.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ basic generator of your own devising: in that case, override the :meth:`random`,
3535
Optionally, a new generator can supply a :meth:`getrandbits` method --- this
3636
allows :meth:`randrange` to produce selections over an arbitrarily large range.
3737

38+
As an example of subclassing, the :mod:`random` module provides the
39+
:class:`WichmannHill` class that implements an alternative generator in pure
40+
Python. The class provides a backward compatible way to reproduce results from
41+
earlier versions of Python, which used the Wichmann-Hill algorithm as the core
42+
generator. Note that this Wichmann-Hill generator can no longer be recommended:
43+
its period is too short by contemporary standards, and the sequence generated is
44+
known to fail some stringent randomness tests. See the references below for a
45+
recent variant that repairs these flaws.
46+
47+
The :mod:`random` module also provides the :class:`SystemRandom` class which
48+
uses the system function :func:`os.urandom` to generate random numbers
49+
from sources provided by the operating system.
3850

3951
Bookkeeping functions:
4052

Doc/library/subprocess.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ This module also defines four shortcut functions:
210210
Run command with arguments. Wait for command to complete, then return the
211211
:attr:`returncode` attribute.
212212

213-
The arguments are the same as for the Popen constructor. Example::
213+
The arguments are the same as for the :class:`Popen` constructor. Example::
214214

215215
>>> retcode = subprocess.call(["ls", "-l"])
216216

@@ -229,7 +229,7 @@ This module also defines four shortcut functions:
229229
:exc:`CalledProcessError` object will have the return code in the
230230
:attr:`returncode` attribute.
231231

232-
The arguments are the same as for the Popen constructor. Example::
232+
The arguments are the same as for the :class:`Popen` constructor. Example::
233233

234234
>>> subprocess.check_call(["ls", "-l"])
235235
0

Doc/library/sys.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ always available.
816816
available only if Python was compiled with :option:`--with-tsc`. To understand
817817
the output of this dump, read :file:`Python/ceval.c` in the Python sources.
818818

819+
.. impl-detail::
820+
This function is intimately bound to CPython implementation details and
821+
thus not likely to be implemented elsewhere.
822+
819823

820824
.. data:: stdin
821825
stdout

Doc/library/xml.dom.minidom.rst

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,12 @@ document: the one that holds all others. Here is an example program::
8282
dom3 = parseString("<myxml>Some data</myxml>")
8383
assert dom3.documentElement.tagName == "myxml"
8484

85-
When you are finished with a DOM, you should clean it up. This is necessary
86-
because some versions of Python do not support garbage collection of objects
87-
that refer to each other in a cycle. Until this restriction is removed from all
88-
versions of Python, it is safest to write your code as if cycles would not be
89-
cleaned up.
90-
91-
The way to clean up a DOM is to call its :meth:`unlink` method::
92-
93-
dom1.unlink()
94-
dom2.unlink()
95-
dom3.unlink()
96-
97-
:meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific extension to the DOM API.
98-
After calling :meth:`unlink` on a node, the node and its descendants are
99-
essentially useless.
100-
85+
When you are finished with a DOM tree, you may optionally call the
86+
:meth:`unlink` method to encourage early cleanup of the now-unneeded
87+
objects. :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific
88+
extension to the DOM API that renders the node and its descendants are
89+
essentially useless. Otherwise, Python's garbage collector will
90+
eventually take care of the objects in the tree.
10191

10292
.. seealso::
10393

Lib/mailbox.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -882,17 +882,9 @@ def remove(self, key):
882882
raise KeyError('No message with key: %s' % key)
883883
else:
884884
raise
885-
try:
886-
if self._locked:
887-
_lock_file(f)
888-
try:
889-
f.close()
890-
os.remove(os.path.join(self._path, str(key)))
891-
finally:
892-
if self._locked:
893-
_unlock_file(f)
894-
finally:
885+
else:
895886
f.close()
887+
os.remove(path)
896888

897889
def __setitem__(self, key, message):
898890
"""Replace the keyed message; raise KeyError if it doesn't exist."""

Lib/pipes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,13 @@ def makepipeline(infile, steps, outfile):
253253
_funnychars = '"`$\\' # Unsafe inside "double quotes"
254254

255255
def quote(file):
256+
''' return a shell-escaped version of the file string '''
256257
for c in file:
257258
if c not in _safechars:
258259
break
259260
else:
261+
if not file:
262+
return "''"
260263
return file
261264
if '\'' not in file:
262265
return '\'' + file + '\''

Lib/test/test_descr.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,6 +4164,15 @@ class X(object):
41644164
x.a = 42
41654165
self.assertEqual(x.a, 42)
41664166

4167+
# Also check type_getattro for correctness.
4168+
class Meta(type):
4169+
pass
4170+
class X(object):
4171+
__metaclass__ = Meta
4172+
X.a = 42
4173+
Meta.a = Descr("a")
4174+
self.assertEqual(X.a, 42)
4175+
41674176
def test_getattr_hooks(self):
41684177
# issue 4230
41694178

0 commit comments

Comments
 (0)