[Python-checkins] cpython (merge 3.2 -> 3.3): #17351: merge with 3.2.

ezio.melotti python-checkins at python.org
Mon Mar 11 08:43:43 CET 2013


http://hg.python.org/cpython/rev/8b1d3fa3b389
changeset:   82602:8b1d3fa3b389
branch:      3.3
parent:      82596:cc08036b37a4
parent:      82601:4f745f7d6fca
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon Mar 11 09:42:40 2013 +0200
summary:
  #17351: merge with 3.2.

files:
  Doc/howto/logging-cookbook.rst         |   6 ++--
  Doc/howto/sorting.rst                  |   2 +-
  Doc/library/contextlib.rst             |   2 +-
  Doc/library/functions.rst              |   2 +-
  Doc/library/unittest.mock-examples.rst |  16 +++++++-------
  Doc/library/unittest.mock.rst          |  16 +++++++-------
  Misc/ACKS                              |   1 +
  7 files changed, 23 insertions(+), 22 deletions(-)


diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -1036,7 +1036,7 @@
 call ``str()`` on that object to get the actual format string. Consider the
 following two classes::
 
-    class BraceMessage(object):
+    class BraceMessage:
         def __init__(self, fmt, *args, **kwargs):
             self.fmt = fmt
             self.args = args
@@ -1045,7 +1045,7 @@
         def __str__(self):
             return self.fmt.format(*self.args, **self.kwargs)
 
-    class DollarMessage(object):
+    class DollarMessage:
         def __init__(self, fmt, **kwargs):
             self.fmt = fmt
             self.kwargs = kwargs
@@ -1372,7 +1372,7 @@
     import random
     import time
 
-    class MyHandler(object):
+    class MyHandler:
         """
         A simple handler for logging events. It runs in the listener process and
         dispatches events to loggers based on the name in the received record,
diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst
--- a/Doc/howto/sorting.rst
+++ b/Doc/howto/sorting.rst
@@ -225,7 +225,7 @@
 
     def cmp_to_key(mycmp):
         'Convert a cmp= function into a key= function'
-        class K(object):
+        class K:
             def __init__(self, obj, *args):
                 self.obj = obj
             def __lt__(self, other):
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -361,7 +361,7 @@
 
    from contextlib import contextmanager, ExitStack
 
-   class ResourceManager(object):
+   class ResourceManager:
 
        def __init__(self, acquire_resource, release_resource, check_resource_ok=None):
            self.acquire_resource = acquire_resource
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -324,7 +324,7 @@
        '__initializing__', '__loader__', '__name__', '__package__',
        '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
        'unpack', 'unpack_from']
-      >>> class Shape(object):
+      >>> class Shape:
       ...     def __dir__(self):
       ...         return ['area', 'perimeter', 'location']
       >>> s = Shape()
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -45,7 +45,7 @@
 This example tests that calling `ProductionClass().method` results in a call to
 the `something` method:
 
-    >>> class ProductionClass(object):
+    >>> class ProductionClass:
     ...     def method(self):
     ...         self.something(1, 2, 3)
     ...     def something(self, a, b, c):
@@ -69,7 +69,7 @@
 The simple `ProductionClass` below has a `closer` method. If it is called with
 an object then it calls `close` on it.
 
-    >>> class ProductionClass(object):
+    >>> class ProductionClass:
     ...     def closer(self, something):
     ...         something.close()
     ...
@@ -398,7 +398,7 @@
 Where you use `patch` to create a mock for you, you can get a reference to the
 mock using the "as" form of the with statement:
 
-    >>> class ProductionClass(object):
+    >>> class ProductionClass:
     ...     def method(self):
     ...         pass
     ...
@@ -446,7 +446,7 @@
 
 So, suppose we have some code that looks a little bit like this:
 
-    >>> class Something(object):
+    >>> class Something:
     ...     def __init__(self):
     ...         self.backend = BackendProvider()
     ...     def method(self):
@@ -554,7 +554,7 @@
 
 Here's an example class with an "iter" method implemented as a generator:
 
-    >>> class Foo(object):
+    >>> class Foo:
     ...     def iter(self):
     ...         for i in [1, 2, 3]:
     ...             yield i
@@ -664,7 +664,7 @@
 It will have `self` passed in as the first argument, which is exactly what I
 wanted:
 
-    >>> class Foo(object):
+    >>> class Foo:
     ...   def foo(self):
     ...     pass
     ...
@@ -1183,7 +1183,7 @@
 You can see in this example how a 'standard' call to `assert_called_with` isn't
 sufficient:
 
-    >>> class Foo(object):
+    >>> class Foo:
     ...     def __init__(self, a, b):
     ...         self.a, self.b = a, b
     ...
@@ -1210,7 +1210,7 @@
 And a matcher object that can use comparison functions like this for its
 equality operation would look something like this:
 
-    >>> class Matcher(object):
+    >>> class Matcher:
     ...     def __init__(self, compare, some_obj):
     ...         self.compare = compare
     ...         self.some_obj = some_obj
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -695,7 +695,7 @@
    Fetching a `PropertyMock` instance from an object calls the mock, with
    no args. Setting it calls the mock with the value being set.
 
-        >>> class Foo(object):
+        >>> class Foo:
         ...     @property
         ...     def foo(self):
         ...         return 'something'
@@ -1031,7 +1031,7 @@
 To configure return values on methods of *instances* on the patched class
 you must do this on the `return_value`. For example:
 
-    >>> class Class(object):
+    >>> class Class:
     ...     def method(self):
     ...         pass
     ...
@@ -1204,7 +1204,7 @@
 magic methods `__getitem__`, `__setitem__`, `__delitem__` and either
 `__iter__` or `__contains__`.
 
-    >>> class Container(object):
+    >>> class Container:
     ...     def __init__(self):
     ...         self.values = {}
     ...     def __getitem__(self, name):
@@ -1378,7 +1378,7 @@
     >>> value = 3
     >>>
     >>> @patch('__main__.value', 'not three')
-    ... class Thing(object):
+    ... class Thing:
     ...     def foo_one(self):
     ...         print value
     ...     def foo_two(self):
@@ -2137,7 +2137,7 @@
 `autospec` can't know about any dynamically created attributes and restricts
 the api to visible attributes.
 
-    >>> class Something(object):
+    >>> class Something:
     ...   def __init__(self):
     ...     self.a = 33
     ...
@@ -2180,7 +2180,7 @@
 
 .. code-block:: python
 
-    class Something(object):
+    class Something:
         a = 33
 
 This brings up another issue. It is relatively common to provide a default
@@ -2191,7 +2191,7 @@
 `autospec` doesn't use a spec for members that are set to `None`. These will
 just be ordinary mocks (well - `MagicMocks`):
 
-    >>> class Something(object):
+    >>> class Something:
     ...     member = None
     ...
     >>> mock = create_autospec(Something)
@@ -2206,7 +2206,7 @@
 the spec. Thankfully `patch` supports this - you can simply pass the
 alternative object as the `autospec` argument:
 
-    >>> class Something(object):
+    >>> class Something:
     ...   def __init__(self):
     ...     self.a = 33
     ...
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -331,6 +331,7 @@
 Julien Élie
 Lance Ellinghaus
 Daniel Ellis
+Phil Elson
 David Ely
 Jeff Epler
 Jeff McNeil

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list