]> granicus.if.org Git - python/commitdiff
keep UserDict an old-style class
authorBenjamin Peterson <benjamin@python.org>
Tue, 22 Jun 2010 18:09:02 +0000 (18:09 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 22 Jun 2010 18:09:02 +0000 (18:09 +0000)
Be generous in abc.py to allow this.

Lib/UserDict.py
Lib/abc.py
Misc/NEWS

index bd64f84d4252866eaf61840617fb748363798bc2..bb2218ab6ce5d808a4016105d69b7b637d1252a6 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 c37ed8fd61bd5c457db63ffd1015b33693321f35..515ba08f23cadab56bf009953eb9f7ace3f6ebdb 100644 (file)
@@ -3,6 +3,8 @@
 
 """Abstract Base Classes (ABCs) according to PEP 3119."""
 
+import types
+
 
 # Instance of old-style class
 class _C: pass
@@ -101,7 +103,7 @@ class ABCMeta(type):
 
     def register(cls, subclass):
         """Register a virtual subclass of an ABC."""
-        if not isinstance(subclass, type):
+        if not isinstance(subclass, (type, types.ClassType)):
             raise TypeError("Can only register classes")
         if issubclass(subclass, cls):
             return  # Already a subclass
index 5926603b117d069281cfacff5b2d3835f0a9c1f3..feab9c55e4a2586ba74a7658c01383b57b4e0f7d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -971,8 +971,6 @@ Library
   position to the given argument, which goes against the tradition of
   ftruncate() and other truncation APIs.  Patch by Pascal Chambon.
 
-- UserDict is now a new-style class.
-
 - Issue #7610: Reworked implementation of the internal ``zipfile.ZipExtFile``
   class used to represent files stored inside an archive.  The new
   implementation is significantly faster and can be wrapped in a