[Python-checkins] r86497 - in python/branches/py3k-cdecimal: Doc/howto/webservers.rst Doc/library/ast.rst Doc/library/atexit.rst Doc/library/bisect.rst Doc/library/calendar.rst Doc/library/cmd.rst Doc/library/collections.rst Doc/library/contextlib.rst Doc/library/dis.rst Doc/library/filecmp.rst Doc/library/fileinput.rst Doc/library/fnmatch.rst Doc/library/functools.rst Doc/library/glob.rst Doc/library/heapq.rst Doc/library/keyword.rst Doc/library/linecache.rst Doc/library/pprint.rst Doc/library/queue.rst Doc/library/quopri.rst Doc/library/random.rst Doc/library/resource.rst Doc/library/sched.rst Doc/library/shelve.rst Doc/library/shutil.rst Doc/library/string.rst Doc/library/textwrap.rst Doc/library/threading.rst Doc/library/tokenize.rst Doc/library/trace.rst Doc/library/uu.rst Doc/whatsnew/3.2.rst Include/patchlevel.h Include/unicodeobject.h Lib/concurrent/futures/_base.py Lib/decimal.py Lib/imaplib.py Lib/test/test_decimal.py Lib/test/test_imaplib.py Lib/test/test_resource.py Misc/NEWS Modules/_io/bufferedio.c Modules/resource.c

stefan.krah python-checkins at python.org
Wed Nov 17 20:47:50 CET 2010


Author: stefan.krah
Date: Wed Nov 17 20:47:49 2010
New Revision: 86497
Log:
Merged revisions 86478-86480,86484-86488,86491-86493 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
 r86478 | alexander.belopolsky | 2010年11月16日 15:29:01 +0100 (2010年11月16日) | 1 line
 
 Issue #10413: Updated comments to reflect code changes
........
 r86479 | georg.brandl | 2010年11月16日 16:15:29 +0100 (2010年11月16日) | 1 line
 
 Add stub for PEP 3148.
........
 r86480 | georg.brandl | 2010年11月16日 16:15:56 +0100 (2010年11月16日) | 1 line
 
 Post-release bumps.
........
 r86484 | antoine.pitrou | 2010年11月16日 18:49:46 +0100 (2010年11月16日) | 3 lines
 
 Avoid some BytesWarnings when running test_imaplib in verbose mode
........
 r86485 | antoine.pitrou | 2010年11月16日 18:55:26 +0100 (2010年11月16日) | 4 lines
 
 Issue #10429: IMAP.starttls() stored the capabilities as bytes objects,
 rather than strings.
........
 r86486 | eric.araujo | 2010年11月16日 20:13:50 +0100 (2010年11月16日) | 4 lines
 
 Provide links to Python source where the code is short, readable and
 informative adjunct to the docs. Forward-port of Raymond's r86225 and
 r86245 using the new source reST role added in #10334.
........
 r86487 | matthias.klose | 2010年11月16日 21:07:51 +0100 (2010年11月16日) | 2 lines
 
 Modules/_io/bufferedio.c (buffered_dealloc_warn): Make it static.
........
 r86488 | ezio.melotti | 2010年11月16日 21:57:59 +0100 (2010年11月16日) | 1 line
 
 Fix typo
........
 r86491 | brian.quinlan | 2010年11月17日 12:06:29 +0100 (2010年11月17日) | 1 line
 
 Removes an inefficient spin loop in as_completed
........
 r86492 | stefan.krah | 2010年11月17日 12:16:34 +0100 (2010年11月17日) | 3 lines
 
 Issue #10356: Decimal(-1).__hash__() should equal hash(Decimal(-1)).
........
 r86493 | antoine.pitrou | 2010年11月17日 17:19:35 +0100 (2010年11月17日) | 4 lines
 
 Issue #10440: Support RUSAGE_THREAD as a constant in the resource module.
 Patch by Robert Collins.
........
Modified:
 python/branches/py3k-cdecimal/ (props changed)
 python/branches/py3k-cdecimal/Doc/howto/webservers.rst
 python/branches/py3k-cdecimal/Doc/library/ast.rst
 python/branches/py3k-cdecimal/Doc/library/atexit.rst
 python/branches/py3k-cdecimal/Doc/library/bisect.rst
 python/branches/py3k-cdecimal/Doc/library/calendar.rst
 python/branches/py3k-cdecimal/Doc/library/cmd.rst
 python/branches/py3k-cdecimal/Doc/library/collections.rst
 python/branches/py3k-cdecimal/Doc/library/contextlib.rst
 python/branches/py3k-cdecimal/Doc/library/dis.rst
 python/branches/py3k-cdecimal/Doc/library/filecmp.rst
 python/branches/py3k-cdecimal/Doc/library/fileinput.rst
 python/branches/py3k-cdecimal/Doc/library/fnmatch.rst
 python/branches/py3k-cdecimal/Doc/library/functools.rst
 python/branches/py3k-cdecimal/Doc/library/glob.rst
 python/branches/py3k-cdecimal/Doc/library/heapq.rst
 python/branches/py3k-cdecimal/Doc/library/keyword.rst
 python/branches/py3k-cdecimal/Doc/library/linecache.rst
 python/branches/py3k-cdecimal/Doc/library/pprint.rst
 python/branches/py3k-cdecimal/Doc/library/queue.rst
 python/branches/py3k-cdecimal/Doc/library/quopri.rst
 python/branches/py3k-cdecimal/Doc/library/random.rst
 python/branches/py3k-cdecimal/Doc/library/resource.rst
 python/branches/py3k-cdecimal/Doc/library/sched.rst
 python/branches/py3k-cdecimal/Doc/library/shelve.rst
 python/branches/py3k-cdecimal/Doc/library/shutil.rst
 python/branches/py3k-cdecimal/Doc/library/string.rst
 python/branches/py3k-cdecimal/Doc/library/textwrap.rst
 python/branches/py3k-cdecimal/Doc/library/threading.rst
 python/branches/py3k-cdecimal/Doc/library/tokenize.rst
 python/branches/py3k-cdecimal/Doc/library/trace.rst
 python/branches/py3k-cdecimal/Doc/library/uu.rst
 python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst
 python/branches/py3k-cdecimal/Include/patchlevel.h
 python/branches/py3k-cdecimal/Include/unicodeobject.h
 python/branches/py3k-cdecimal/Lib/concurrent/futures/_base.py
 python/branches/py3k-cdecimal/Lib/decimal.py
 python/branches/py3k-cdecimal/Lib/imaplib.py
 python/branches/py3k-cdecimal/Lib/test/test_decimal.py
 python/branches/py3k-cdecimal/Lib/test/test_imaplib.py
 python/branches/py3k-cdecimal/Lib/test/test_resource.py
 python/branches/py3k-cdecimal/Misc/NEWS
 python/branches/py3k-cdecimal/Modules/_io/bufferedio.c
 python/branches/py3k-cdecimal/Modules/resource.c
Modified: python/branches/py3k-cdecimal/Doc/howto/webservers.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/howto/webservers.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/howto/webservers.rst	Wed Nov 17 20:47:49 2010
@@ -526,7 +526,7 @@
 
 .. seealso::
 
- There are many template engines competing for attention, becuase it is
+ There are many template engines competing for attention, because it is
 pretty easy to create them in Python. The page `Templating
 <http://wiki.python.org/moin/Templating>`_ in the wiki lists a big,
 ever-growing number of these. The three listed above are considered "second
Modified: python/branches/py3k-cdecimal/Doc/library/ast.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/ast.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/ast.rst	Wed Nov 17 20:47:49 2010
@@ -19,6 +19,9 @@
 classes all inherit from :class:`ast.AST`. An abstract syntax tree can be
 compiled into a Python code object using the built-in :func:`compile` function.
 
+.. seealso::
+
+ Latest version of the :source:`ast module Python source code <Lib/ast.py>`
 
 Node classes
 ------------
Modified: python/branches/py3k-cdecimal/Doc/library/atexit.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/atexit.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/atexit.rst	Wed Nov 17 20:47:49 2010
@@ -11,6 +11,11 @@
 functions. Functions thus registered are automatically executed upon normal
 interpreter termination.
 
+.. seealso::
+
+ Latest version of the :source:`atexit Python source code
+ <Lib/atexit.py>`
+
 Note: the functions registered via this module are not called when the program
 is killed by a signal not handled by Python, when a Python fatal internal error
 is detected, or when :func:`os._exit` is called.
Modified: python/branches/py3k-cdecimal/Doc/library/bisect.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/bisect.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/bisect.rst	Wed Nov 17 20:47:49 2010
@@ -14,6 +14,11 @@
 algorithm to do its work. The source code may be most useful as a working
 example of the algorithm (the boundary conditions are already right!).
 
+.. seealso::
+
+ Latest version of the :source:`bisect module Python source code
+ <Lib/bisect.py>`
+
 The following functions are provided:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/calendar.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/calendar.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/calendar.rst	Wed Nov 17 20:47:49 2010
@@ -21,6 +21,10 @@
 calendar in Dershowitz and Reingold's book "Calendrical Calculations", where
 it's the base calendar for all computations.
 
+.. seealso::
+
+ Latest version of the :source:`calendar module Python source code
+ <Lib/calendar.py>`
 
 .. class:: Calendar(firstweekday=0)
 
Modified: python/branches/py3k-cdecimal/Doc/library/cmd.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/cmd.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/cmd.rst	Wed Nov 17 20:47:49 2010
@@ -11,6 +11,9 @@
 tools, and prototypes that will later be wrapped in a more sophisticated
 interface.
 
+.. seealso::
+
+ Latest version of the :source:`cmd module Python source code <Lib/cmd.py>`
 
 .. class:: Cmd(completekey='tab', stdin=None, stdout=None)
 
Modified: python/branches/py3k-cdecimal/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/collections.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/collections.rst	Wed Nov 17 20:47:49 2010
@@ -31,6 +31,11 @@
 ABCs (abstract base classes) that can be used to test whether a class provides a
 particular interface, for example, whether it is hashable or a mapping.
 
+.. seealso::
+
+ Latest version of the :source:`collections module Python source code
+ <Lib/collections.py>`
+
 
 :class:`Counter` objects
 ------------------------
@@ -1059,6 +1064,9 @@
 
 .. seealso::
 
+ * Latest version of the :source:`Python source code for the collections
+ abstract base classes <Lib/_abcoll.py>`
+
 * `OrderedSet recipe <http://code.activestate.com/recipes/576694/>`_ for an
 example built on :class:`MutableSet`.
 
Modified: python/branches/py3k-cdecimal/Doc/library/contextlib.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/contextlib.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/contextlib.rst	Wed Nov 17 20:47:49 2010
@@ -9,6 +9,11 @@
 statement. For more information see also :ref:`typecontextmanager` and
 :ref:`context-managers`.
 
+.. seealso::
+
+ Latest version of the :source:`contextlib Python source code
+ <Lib/contextlib.py>`
+
 Functions provided:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/dis.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/dis.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/dis.rst	Wed Nov 17 20:47:49 2010
@@ -10,6 +10,10 @@
 input is defined in the file :file:`Include/opcode.h` and used by the compiler
 and the interpreter.
 
+.. seealso::
+
+ Latest version of the :source:`dis module Python source code <Lib/dis.py>`
+
 .. impl-detail::
 
 Bytecode is an implementation detail of the CPython interpreter! No
Modified: python/branches/py3k-cdecimal/Doc/library/filecmp.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/filecmp.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/filecmp.rst	Wed Nov 17 20:47:49 2010
@@ -10,6 +10,11 @@
 with various optional time/correctness trade-offs. For comparing files,
 see also the :mod:`difflib` module.
 
+.. seealso::
+
+ Latest version of the :source:`filecmp Python source code
+ <Lib/filecmp.py>`
+
 The :mod:`filecmp` module defines the following functions:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/fileinput.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/fileinput.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/fileinput.rst	Wed Nov 17 20:47:49 2010
@@ -44,6 +44,11 @@
 returns an accordingly opened file-like object. Two useful hooks are already
 provided by this module.
 
+.. seealso::
+
+ Latest version of the :source:`fileinput Python source code
+ <Lib/fileinput.py>`
+
 The following function is the primary interface of this module:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/fnmatch.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/fnmatch.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/fnmatch.rst	Wed Nov 17 20:47:49 2010
@@ -33,6 +33,10 @@
 a period are not special for this module, and are matched by the ``*`` and ``?``
 patterns.
 
+.. seealso::
+
+ Latest version of the :source:`fnmatch Python source code
+ <Lib/fnmatch.py>`
 
 .. function:: fnmatch(filename, pattern)
 
Modified: python/branches/py3k-cdecimal/Doc/library/functools.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/functools.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/functools.rst	Wed Nov 17 20:47:49 2010
@@ -13,6 +13,11 @@
 or return other functions. In general, any callable object can be treated as a
 function for the purposes of this module.
 
+.. seealso::
+
+ Latest version of the :source:`functools Python source code
+ <Lib/functools.py>`
+
 The :mod:`functools` module defines the following functions:
 
 .. function:: cmp_to_key(func)
Modified: python/branches/py3k-cdecimal/Doc/library/glob.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/glob.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/glob.rst	Wed Nov 17 20:47:49 2010
@@ -15,6 +15,9 @@
 subshell. (For tilde and shell variable expansion, use
 :func:`os.path.expanduser` and :func:`os.path.expandvars`.)
 
+.. seealso::
+
+ Latest version of the :source:`glob module Python source code <Lib/glob.py>`
 
 .. function:: glob(pathname)
 
Modified: python/branches/py3k-cdecimal/Doc/library/heapq.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/heapq.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/heapq.rst	Wed Nov 17 20:47:49 2010
@@ -11,6 +11,11 @@
 This module provides an implementation of the heap queue algorithm, also known
 as the priority queue algorithm.
 
+.. seealso::
+
+ Latest version of the :source:`heapq Python source code
+ <Lib/heapq.py>`
+
 Heaps are arrays for which ``heap[k] <= heap[2*k+1]`` and ``heap[k] <=
 heap[2*k+2]`` for all *k*, counting elements from zero. For the sake of
 comparison, non-existing elements are considered to be infinite. The
Modified: python/branches/py3k-cdecimal/Doc/library/keyword.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/keyword.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/keyword.rst	Wed Nov 17 20:47:49 2010
@@ -19,3 +19,8 @@
 keywords are defined to only be active when particular :mod:`__future__`
 statements are in effect, these will be included as well.
 
+
+.. seealso::
+
+ Latest version of the :source:`keyword module Python source code
+ <Lib/keyword.py>`
Modified: python/branches/py3k-cdecimal/Doc/library/linecache.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/linecache.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/linecache.rst	Wed Nov 17 20:47:49 2010
@@ -11,6 +11,11 @@
 lines are read from a single file. This is used by the :mod:`traceback` module
 to retrieve source lines for inclusion in the formatted traceback.
 
+.. seealso::
+
+ Latest version of the :source:`linecache module Python source code
+ <Lib/linecache.py>`
+
 The :mod:`linecache` module defines the following functions:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/pprint.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/pprint.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/pprint.rst	Wed Nov 17 20:47:49 2010
@@ -21,6 +21,11 @@
 
 Dictionaries are sorted by key before the display is computed.
 
+.. seealso::
+
+ Latest version of the :source:`pprint module Python source code
+ <Lib/pprint.py>`
+
 The :mod:`pprint` module defines one class:
 
 .. First the implementation class:
Modified: python/branches/py3k-cdecimal/Doc/library/queue.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/queue.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/queue.rst	Wed Nov 17 20:47:49 2010
@@ -19,6 +19,11 @@
 the entries are kept sorted (using the :mod:`heapq` module) and the
 lowest valued entry is retrieved first.
 
+.. seealso::
+
+ Latest version of the :source:`queue module Python source code
+ <Lib/queue.py>`
+
 The :mod:`queue` module defines the following classes and exceptions:
 
 .. class:: Queue(maxsize=0)
Modified: python/branches/py3k-cdecimal/Doc/library/quopri.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/quopri.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/quopri.rst	Wed Nov 17 20:47:49 2010
@@ -17,6 +17,10 @@
 :mod:`base64` module is more compact if there are many such characters, as when
 sending a graphics file.
 
+.. seealso::
+
+ Latest version of the :source:`quopri module Python source code
+ <Lib/quopri.py>`
 
 .. function:: decode(input, output, header=False)
 
Modified: python/branches/py3k-cdecimal/Doc/library/random.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/random.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/random.rst	Wed Nov 17 20:47:49 2010
@@ -8,6 +8,11 @@
 This module implements pseudo-random number generators for various
 distributions.
 
+.. seealso::
+
+ Latest version of the :source:`random module Python source code
+ <Lib/random.py>`
+
 For integers, there is uniform selection from a range. For sequences, there is
 uniform selection of a random element, a function to generate a random
 permutation of a list in-place, and a function for random sampling without
Modified: python/branches/py3k-cdecimal/Doc/library/resource.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/resource.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/resource.rst	Wed Nov 17 20:47:49 2010
@@ -217,14 +217,14 @@
 
 .. data:: RUSAGE_SELF
 
- :const:`RUSAGE_SELF` should be used to request information pertaining only to
- the process itself.
+ Pass to :func:`getrusage` to request resources consumed by the calling
+ process, which is the sum of resources used by all threads in the process.
 
 
 .. data:: RUSAGE_CHILDREN
 
- Pass to :func:`getrusage` to request resource information for child processes of
- the calling process.
+ Pass to :func:`getrusage` to request resources consumed by child processes
+ of the calling process which have been terminated and waited for.
 
 
 .. data:: RUSAGE_BOTH
@@ -232,3 +232,10 @@
 Pass to :func:`getrusage` to request resources consumed by both the current
 process and child processes. May not be available on all systems.
 
+
+.. data:: RUSAGE_THREAD
+
+ Pass to :func:`getrusage` to request resources consumed by the current
+ thread. May not be available on all systems.
+
+ .. versionadded:: 3.2
Modified: python/branches/py3k-cdecimal/Doc/library/sched.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/sched.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/sched.rst	Wed Nov 17 20:47:49 2010
@@ -10,6 +10,10 @@
 The :mod:`sched` module defines a class which implements a general purpose event
 scheduler:
 
+.. seealso::
+
+ Latest version of the :source:`sched module Python source code
+ <Lib/sched.py>`
 
 .. class:: scheduler(timefunc, delayfunc)
 
Modified: python/branches/py3k-cdecimal/Doc/library/shelve.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/shelve.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/shelve.rst	Wed Nov 17 20:47:49 2010
@@ -13,6 +13,10 @@
 This includes most class instances, recursive data types, and objects containing
 lots of shared sub-objects. The keys are ordinary strings.
 
+.. seealso::
+
+ Latest version of the :source:`shelve module Python source code
+ <Lib/shelve.py>`
 
 .. function:: open(filename, flag='c', protocol=None, writeback=False)
 
Modified: python/branches/py3k-cdecimal/Doc/library/shutil.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/shutil.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/shutil.rst	Wed Nov 17 20:47:49 2010
@@ -15,6 +15,11 @@
 copying and removal. For operations on individual files, see also the
 :mod:`os` module.
 
+.. seealso::
+
+ Latest version of the :source:`shutil module Python source code
+ <Lib/shutil.py>`
+
 .. warning::
 
 Even the higher-level file copying functions (:func:`copy`, :func:`copy2`)
@@ -26,6 +31,7 @@
 not be correct. On Windows, file owners, ACLs and alternate data streams
 are not copied.
 
+
 Directory and files operations
 ------------------------------
 
Modified: python/branches/py3k-cdecimal/Doc/library/string.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/string.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/string.rst	Wed Nov 17 20:47:49 2010
@@ -15,6 +15,11 @@
 :ref:`string-formatting` section. Also, see the :mod:`re` module for
 string functions based on regular expressions.
 
+.. seealso::
+
+ Latest version of the :source:`string module Python source code
+ <Lib/string.py>`
+
 
 String constants
 ----------------
Modified: python/branches/py3k-cdecimal/Doc/library/textwrap.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/textwrap.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/textwrap.rst	Wed Nov 17 20:47:49 2010
@@ -13,6 +13,10 @@
 or two text strings, the convenience functions should be good enough;
 otherwise, you should use an instance of :class:`TextWrapper` for efficiency.
 
+.. seealso::
+
+ Latest version of the :source:`textwrap module Python source code
+ <Lib/textwrap.py>`
 
 .. function:: wrap(text, width=70, **kwargs)
 
Modified: python/branches/py3k-cdecimal/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/threading.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/threading.rst	Wed Nov 17 20:47:49 2010
@@ -17,6 +17,11 @@
 methods and functions in this module in the Python 2.x series are still
 supported by this module.
 
+.. seealso::
+
+ Latest version of the :source:`threading module Python source code
+ <Lib/threading.py>`
+
 This module defines the following functions and objects:
 
 
Modified: python/branches/py3k-cdecimal/Doc/library/tokenize.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/tokenize.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/tokenize.rst	Wed Nov 17 20:47:49 2010
@@ -12,6 +12,11 @@
 as well, making it useful for implementing "pretty-printers," including
 colorizers for on-screen displays.
 
+.. seealso::
+
+ Latest version of the :source:`tokenize module Python source code
+ <Lib/tokenize.py>`
+
 The primary entry point is a :term:`generator`:
 
 .. function:: tokenize(readline)
Modified: python/branches/py3k-cdecimal/Doc/library/trace.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/trace.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/trace.rst	Wed Nov 17 20:47:49 2010
@@ -10,6 +10,10 @@
 list functions executed during a program run. It can be used in another program
 or from the command line.
 
+.. seealso::
+
+ Latest version of the :source:`trace module Python source code
+ <Lib/trace.py>`
 
 .. _trace-cli:
 
Modified: python/branches/py3k-cdecimal/Doc/library/uu.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/uu.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/uu.rst	Wed Nov 17 20:47:49 2010
@@ -21,6 +21,10 @@
 
 This code was contributed by Lance Ellinghouse, and modified by Jack Jansen.
 
+.. seealso::
+
+ Latest version of the :source:`uu module Python source code <Lib/uu.py>`
+
 The :mod:`uu` module defines the following functions:
 
 
Modified: python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst	Wed Nov 17 20:47:49 2010
@@ -97,6 +97,11 @@
 :pep:`391` - Dictionary Based Configuration for Logging
 PEP written by Vinay Sajip.
 
+PEP 3148: The ``concurrent.futures`` module
+============================================
+
+.. (Stub section)
+
 
 PEP 3147: PYC Repository Directories
 =====================================
Modified: python/branches/py3k-cdecimal/Include/patchlevel.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/patchlevel.h	(original)
+++ python/branches/py3k-cdecimal/Include/patchlevel.h	Wed Nov 17 20:47:49 2010
@@ -23,7 +23,7 @@
 #define PY_RELEASE_SERIAL	4
 
 /* Version as a string */
-#define PY_VERSION 	"3.2a4"
+#define PY_VERSION 	"3.2a4+"
 /*--end constants--*/
 
 /* Subversion Revision number of this file (not of the repository) */
Modified: python/branches/py3k-cdecimal/Include/unicodeobject.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/unicodeobject.h	(original)
+++ python/branches/py3k-cdecimal/Include/unicodeobject.h	Wed Nov 17 20:47:49 2010
@@ -7,7 +7,8 @@
 
 Unicode implementation based on original code by Fredrik Lundh,
 modified by Marc-Andre Lemburg (mal at lemburg.com) according to the
-Unicode Integration Proposal (see file Misc/unicode.txt).
+Unicode Integration Proposal. (See
+http://www.egenix.com/files/python/unicode-proposal.txt).
 
 Copyright (c) Corporation for National Research Initiatives.
 
@@ -354,8 +355,8 @@
 for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
 } while (0)
 
-/* Check if substring matches at given offset. the offset must be
- valid, and the substring must not be empty */
+/* Check if substring matches at given offset. The offset must be
+ valid, and the substring must not be empty. */
 
 #define Py_UNICODE_MATCH(string, offset, substring) \
 ((*((string)->str + (offset)) == *((substring)->str)) && \
@@ -483,8 +484,8 @@
 Coercion is done in the following way:
 
 1. bytes, bytearray and other char buffer compatible objects are decoded
- under the assumptions that they contain data using the current
- default encoding. Decoding is done in "strict" mode.
+ under the assumptions that they contain data using the UTF-8
+ encoding. Decoding is done in "strict" mode.
 
 2. All other objects (including Unicode objects) raise an
 exception.
@@ -614,7 +615,7 @@
 
 Many of these APIs take two arguments encoding and errors. These
 parameters encoding and errors have the same semantics as the ones
- of the builtin unicode() API.
+ of the builtin str() API.
 
 Setting encoding to NULL causes the default encoding (UTF-8) to be used.
 
@@ -633,7 +634,8 @@
 /* Return a Python string holding the default encoded value of the
 Unicode object.
 
- The resulting string is cached in the Unicode object for subsequent
+ Same as PyUnicode_AsUTF8String() except
+ the resulting string is cached in the Unicode object for subsequent
 usage by this function. The cached version is needed to implement
 the character buffer interface and will live (at least) as long as
 the Unicode object itself.
@@ -648,14 +650,14 @@
 PyObject *unicode,
 const char *errors);
 
-/* Returns a pointer to the default encoding (normally, UTF-8) of the
+/* Returns a pointer to the default encoding (UTF-8) of the
 Unicode object unicode and the size of the encoded representation
 in bytes stored in *size.
 
 In case of an error, no *size is set.
 
 *** This API is for interpreter INTERNAL USE ONLY and will likely
- *** be removed or changed for Python 3.1.
+ *** be removed or changed in the future.
 
 *** If you need to access the Unicode object as UTF-8 bytes string,
 *** please use PyUnicode_AsUTF8String() instead.
@@ -666,7 +668,7 @@
 PyObject *unicode,
 Py_ssize_t *size);
 
-/* Returns a pointer to the default encoding (normally, UTf-8) of the
+/* Returns a pointer to the default encoding (UTF-8) of the
 Unicode object unicode.
 
 Use of this API is DEPRECATED since no size information can be
@@ -682,14 +684,7 @@
 
 PyAPI_FUNC(char *) _PyUnicode_AsString(PyObject *unicode);
 
-/* Returns the currently active default encoding.
-
- The default encoding is currently implemented as run-time settable
- process global. This may change in future versions of the
- interpreter to become a parameter which is managed on a per-thread
- basis.
-
- */
+/* Returns "utf-8". */
 
 PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
 
Modified: python/branches/py3k-cdecimal/Lib/concurrent/futures/_base.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/concurrent/futures/_base.py	(original)
+++ python/branches/py3k-cdecimal/Lib/concurrent/futures/_base.py	Wed Nov 17 20:47:49 2010
@@ -12,6 +12,7 @@
 FIRST_COMPLETED = 'FIRST_COMPLETED'
 FIRST_EXCEPTION = 'FIRST_EXCEPTION'
 ALL_COMPLETED = 'ALL_COMPLETED'
+_AS_COMPLETED = '_AS_COMPLETED'
 
 # Possible future states (for internal use by the futures package).
 PENDING = 'PENDING'
@@ -70,8 +71,30 @@
 def add_cancelled(self, future):
 self.finished_futures.append(future)
 
+class _AsCompletedWaiter(_Waiter):
+ """Used by as_completed()."""
+
+ def __init__(self):
+ super(_AsCompletedWaiter, self).__init__()
+ self.lock = threading.Lock()
+
+ def add_result(self, future):
+ with self.lock:
+ super(_AsCompletedWaiter, self).add_result(future)
+ self.event.set()
+
+ def add_exception(self, future):
+ with self.lock:
+ super(_AsCompletedWaiter, self).add_exception(future)
+ self.event.set()
+
+ def add_cancelled(self, future):
+ with self.lock:
+ super(_AsCompletedWaiter, self).add_cancelled(future)
+ self.event.set()
+
 class _FirstCompletedWaiter(_Waiter):
- """Used by wait(return_when=FIRST_COMPLETED) and as_completed()."""
+ """Used by wait(return_when=FIRST_COMPLETED)."""
 
 def add_result(self, future):
 super().add_result(future)
@@ -128,7 +151,9 @@
 future._condition.release()
 
 def _create_and_install_waiters(fs, return_when):
- if return_when == FIRST_COMPLETED:
+ if return_when == _AS_COMPLETED:
+ waiter = _AsCompletedWaiter()
+ elif return_when == FIRST_COMPLETED:
 waiter = _FirstCompletedWaiter()
 else:
 pending_count = sum(
@@ -171,7 +196,7 @@
 f for f in fs
 if f._state in [CANCELLED_AND_NOTIFIED, FINISHED])
 pending = set(fs) - finished
- waiter = _create_and_install_waiters(fs, FIRST_COMPLETED)
+ waiter = _create_and_install_waiters(fs, _AS_COMPLETED)
 
 try:
 for future in finished:
@@ -187,11 +212,15 @@
 '%d (of %d) futures unfinished' % (
 len(pending), len(fs)))
 
- waiter.event.wait(timeout)
+ waiter.event.wait(wait_timeout)
+
+ with waiter.lock:
+ finished = waiter.finished_futures
+ waiter.finished_futures = []
+ waiter.event.clear()
 
- for future in waiter.finished_futures[:]:
+ for future in finished:
 yield future
- waiter.finished_futures.remove(future)
 pending.remove(future)
 
 finally:
Modified: python/branches/py3k-cdecimal/Lib/decimal.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/decimal.py	(original)
+++ python/branches/py3k-cdecimal/Lib/decimal.py	Wed Nov 17 20:47:49 2010
@@ -957,7 +957,8 @@
 else:
 exp_hash = pow(_PyHASH_10INV, -self._exp, _PyHASH_MODULUS)
 hash_ = int(self._int) * exp_hash % _PyHASH_MODULUS
- return hash_ if self >= 0 else -hash_
+ ans = hash_ if self >= 0 else -hash_
+ return -2 if ans == -1 else ans
 
 def as_tuple(self):
 """Represents the number as a triple tuple.
Modified: python/branches/py3k-cdecimal/Lib/imaplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/imaplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/imaplib.py	Wed Nov 17 20:47:49 2010
@@ -196,13 +196,7 @@
 else:
 raise self.error(self.welcome)
 
- typ, dat = self.capability()
- if dat == [None]:
- raise self.error('no CAPABILITY response from server')
- dat = str(dat[-1], "ASCII")
- dat = dat.upper()
- self.capabilities = tuple(dat.split())
-
+ self._get_capabilities()
 if __debug__:
 if self.debug >= 3:
 self._mesg('CAPABILITIES: %r' % (self.capabilities,))
@@ -737,10 +731,7 @@
 self.sock = ssl_context.wrap_socket(self.sock)
 self.file = self.sock.makefile('rb')
 self._tls_established = True
- typ, dat = self.capability()
- if dat == [None]:
- raise self.error('no CAPABILITY response from server')
- self.capabilities = tuple(dat[-1].upper().split())
+ self._get_capabilities()
 else:
 raise self.error("Couldn't establish TLS session")
 return self._untagged_response(typ, dat, name)
@@ -956,6 +947,15 @@
 return typ, data
 
 
+ def _get_capabilities(self):
+ typ, dat = self.capability()
+ if dat == [None]:
+ raise self.error('no CAPABILITY response from server')
+ dat = str(dat[-1], "ASCII")
+ dat = dat.upper()
+ self.capabilities = tuple(dat.split())
+
+
 def _get_response(self):
 
 # Read response and store.
Modified: python/branches/py3k-cdecimal/Lib/test/test_decimal.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_decimal.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_decimal.py	Wed Nov 17 20:47:49 2010
@@ -1299,19 +1299,26 @@
 self.assertEqual(id(dc), id(d))
 
 def test_hash_method(self):
+ def hashit(d):
+ a = hash(d)
+ b = d.__hash__()
+ self.assertEqual(a, b)
+ return a
+
 #just that it's hashable
- hash(Decimal(23))
- hash(Decimal('Infinity'))
- hash(Decimal('-Infinity'))
- hash(Decimal('nan123'))
- hash(Decimal('-NaN'))
+ hashit(Decimal(23))
+ hashit(Decimal('Infinity'))
+ hashit(Decimal('-Infinity'))
+ hashit(Decimal('nan123'))
+ hashit(Decimal('-NaN'))
 
 test_values = [Decimal(sign*(2**m + n))
 for m in [0, 14, 15, 16, 17, 30, 31,
- 32, 33, 62, 63, 64, 65, 66]
+ 32, 33, 61, 62, 63, 64, 65, 66]
 for n in range(-10, 10)
 for sign in [-1, 1]]
 test_values.extend([
+ Decimal("-1"), # ==> -2
 Decimal("-0"), # zeros
 Decimal("0.00"),
 Decimal("-0.000"),
@@ -1335,13 +1342,13 @@
 
 # check that hash(d) == hash(int(d)) for integral values
 for value in test_values:
- self.assertEqual(hash(value), hash(int(value)))
+ self.assertEqual(hashit(value), hashit(int(value)))
 
 #the same hash that to an int
- self.assertEqual(hash(Decimal(23)), hash(23))
+ self.assertEqual(hashit(Decimal(23)), hashit(23))
 self.assertRaises(TypeError, hash, Decimal('sNaN'))
- self.assertTrue(hash(Decimal('Inf')))
- self.assertTrue(hash(Decimal('-Inf')))
+ self.assertTrue(hashit(Decimal('Inf')))
+ self.assertTrue(hashit(Decimal('-Inf')))
 
 # check that the hashes of a Decimal float match when they
 # represent exactly the same values
@@ -1350,7 +1357,7 @@
 for s in test_strings:
 f = float(s)
 d = Decimal(s)
- self.assertEqual(hash(f), hash(d))
+ self.assertEqual(hashit(f), hashit(d))
 
 # check that the value of the hash doesn't depend on the
 # current context (issue #1757)
@@ -1359,11 +1366,11 @@
 x = Decimal("123456789.1")
 
 c.prec = 6
- h1 = hash(x)
+ h1 = hashit(x)
 c.prec = 10
- h2 = hash(x)
+ h2 = hashit(x)
 c.prec = 16
- h3 = hash(x)
+ h3 = hashit(x)
 
 self.assertEqual(h1, h2)
 self.assertEqual(h1, h3)
Modified: python/branches/py3k-cdecimal/Lib/test/test_imaplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_imaplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_imaplib.py	Wed Nov 17 20:47:49 2010
@@ -60,7 +60,7 @@
 timeout = 1
 
 def _send(self, message):
- if verbose: print("SENT:", message.strip())
+ if verbose: print("SENT: %r" % message.strip())
 self.wfile.write(message)
 
 def handle(self):
@@ -84,7 +84,7 @@
 if line.endswith(b'\r\n'):
 break
 
- if verbose: print('GOT:', line.strip())
+ if verbose: print('GOT: %r' % line.strip())
 splitline = line.split()
 tag = splitline[0].decode('ASCII')
 cmd = splitline[1].decode('ASCII')
@@ -208,6 +208,8 @@
 self.server.logout()
 
 def test_logincapa(self):
+ for cap in self.server.capabilities:
+ self.assertIsInstance(cap, str)
 self.assertTrue('LOGINDISABLED' in self.server.capabilities)
 self.assertTrue('AUTH=ANONYMOUS' in self.server.capabilities)
 rs = self.server.login(self.username, self.password)
@@ -228,6 +230,8 @@
 self.assertEqual(rs[0], 'OK')
 
 def test_logincapa(self):
+ for cap in self.server.capabilities:
+ self.assertIsInstance(cap, str)
 self.assertFalse('LOGINDISABLED' in self.server.capabilities)
 
 
@@ -237,6 +241,8 @@
 imap_class = IMAP4_SSL
 
 def test_logincapa(self):
+ for cap in self.server.capabilities:
+ self.assertIsInstance(cap, str)
 self.assertFalse('LOGINDISABLED' in self.server.capabilities)
 self.assertTrue('AUTH=PLAIN' in self.server.capabilities)
 
Modified: python/branches/py3k-cdecimal/Lib/test/test_resource.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_resource.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_resource.py	Wed Nov 17 20:47:49 2010
@@ -102,6 +102,10 @@
 usageboth = resource.getrusage(resource.RUSAGE_BOTH)
 except (ValueError, AttributeError):
 pass
+ try:
+ usage_thread = resource.getrusage(resource.RUSAGE_THREAD)
+ except (ValueError, AttributeError):
+ pass
 
 def test_main(verbose=None):
 support.run_unittest(ResourceTest)
Modified: python/branches/py3k-cdecimal/Misc/NEWS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/NEWS	(original)
+++ python/branches/py3k-cdecimal/Misc/NEWS	Wed Nov 17 20:47:49 2010
@@ -2,6 +2,24 @@
 Python News
 +++++++++++
 
+What's New in Python 3.2 Beta 1?
+================================
+
+*Release date: XX-Dec-2010*
+
+Core and Builtins
+-----------------
+
+Library
+-------
+
+- Issue #10440: Support RUSAGE_THREAD as a constant in the resource module.
+ Patch by Robert Collins.
+
+- Issue #10429: IMAP.starttls() stored the capabilities as bytes objects,
+ rather than strings.
+
+
 What's New in Python 3.2 Alpha 4?
 =================================
 
@@ -63,6 +81,8 @@
 Library
 -------
 
+- Issue #10356: Decimal.__hash__(-1) should return -2.
+
 - Issue #1553375: logging: Added stack_info kwarg to display stack information.
 
 - Issue #5111: IPv6 Host in the Header is wrapped inside [ ]. Patch by Chandru.
Modified: python/branches/py3k-cdecimal/Modules/_io/bufferedio.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_io/bufferedio.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_io/bufferedio.c	Wed Nov 17 20:47:49 2010
@@ -387,7 +387,7 @@
 /* Because this can call arbitrary code, it shouldn't be called when
 the refcount is 0 (that is, not directly from tp_dealloc unless
 the refcount has been temporarily re-incremented). */
-PyObject *
+static PyObject *
 buffered_dealloc_warn(buffered *self, PyObject *source)
 {
 if (self->ok && self->raw) {
Modified: python/branches/py3k-cdecimal/Modules/resource.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/resource.c	(original)
+++ python/branches/py3k-cdecimal/Modules/resource.c	Wed Nov 17 20:47:49 2010
@@ -325,6 +325,10 @@
 PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH);
 #endif
 
+#ifdef RUSAGE_THREAD
+ PyModule_AddIntConstant(m, "RUSAGE_THREAD", RUSAGE_THREAD);
+#endif
+
 #if defined(HAVE_LONG_LONG)
 if (sizeof(RLIM_INFINITY) > sizeof(long)) {
 v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /