]> granicus.if.org Git - python/commitdiff
revert r77790. it requires a new-style class change
authorBenjamin Peterson <benjamin@python.org>
Thu, 28 Jan 2010 01:31:13 +0000 (01:31 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 28 Jan 2010 01:31:13 +0000 (01:31 +0000)
Lib/UserDict.py
Lib/abc.py
Lib/test/test_abc.py
Misc/NEWS

index df5f7fbe49e16c466246abf6febc33e6f7663f2b..0d9591a96675f3a745d3f42cbe035aaa30da418d 100644 (file)
@@ -1,6 +1,6 @@
 """A more or less complete user-defined wrapper around dictionary objects."""
 
-class UserDict(object):
+class UserDict:
     def __init__(self, dict=None, **kwargs):
         self.data = {}
         if dict is not None:
index 8aeb2af616955893d0043fe28f8a9f857bcfd866..95126d8a18ae3d534491172db863cc8bd4c9ed01 100644 (file)
@@ -96,7 +96,7 @@ class ABCMeta(type):
 
     def register(cls, subclass):
         """Register a virtual subclass of an ABC."""
-        if not isinstance(subclass, type):
+        if not isinstance(cls, type):
             raise TypeError("Can only register classes")
         if issubclass(subclass, cls):
             return  # Already a subclass
index fa20173df1eb526caa8eb1da38a1c4ed980de670..3e0955fd75ffcb6d009ae6c1a89db1d10641d5ea 100644 (file)
@@ -149,11 +149,6 @@ class TestABC(unittest.TestCase):
         self.assertRaises(RuntimeError, C.register, A)  # cycles not allowed
         C.register(B)  # ok
 
-    def test_register_non_class(self):
-        class A(object):
-            __metaclass__ = abc.ABCMeta
-        self.assertRaises(TypeError, A.register, 4)
-
     def test_registration_transitiveness(self):
         class A:
             __metaclass__ = abc.ABCMeta
index 6c15fe6c71d5b16284cb17198ff41d9592a07bb4..d518010a39acd893176331bd1f96dc4bccbaf216 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,8 +58,6 @@ Library
   file position to the given argument, which goes against the tradition of
   ftruncate() and other truncation APIs.  Patch by Pascal Chambon.
 
-- Issue #7792: Registering non-classes to ABCs raised an obscure error.
-
 - Issue #7773: Fix an UnboundLocalError in platform.linux_distribution() when
   the release file is empty.