summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-06-22 18:09:02 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-06-22 18:09:02 (GMT)
commitbde67df0cd4de5e034c2cf4bd43c0d5657649942 (patch)
tree33b1ad6217fdcc079f6463fdcff033f73bf0edb1 /Lib
parent3ceab01cefa149ade3bed218e9c03ac791f0e8cc (diff)
downloadcpython-bde67df0cd4de5e034c2cf4bd43c0d5657649942.zip
cpython-bde67df0cd4de5e034c2cf4bd43c0d5657649942.tar.gz
cpython-bde67df0cd4de5e034c2cf4bd43c0d5657649942.tar.bz2
keep UserDict an old-style class
Be generous in abc.py to allow this.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/UserDict.py2
-rw-r--r--Lib/abc.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/UserDict.py b/Lib/UserDict.py
index bd64f84..bb2218a 100644
--- a/Lib/UserDict.py
+++ b/Lib/UserDict.py
@@ -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:
diff --git a/Lib/abc.py b/Lib/abc.py
index c37ed8f..515ba08 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -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