Skip to content

Commit bde67df

Browse files
committed
keep UserDict an old-style class
Be generous in abc.py to allow this.
1 parent 3ceab01 commit bde67df

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/UserDict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""A more or less complete user-defined wrapper around dictionary objects."""
22

3-
class UserDict(object):
3+
class UserDict:
44
def __init__(self, dict=None, **kwargs):
55
self.data = {}
66
if dict is not None:

Lib/abc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Abstract Base Classes (ABCs) according to PEP 3119."""
55

6+
import types
7+
68

79
# Instance of old-style class
810
class _C: pass
@@ -101,7 +103,7 @@ def __new__(mcls, name, bases, namespace):
101103

102104
def register(cls, subclass):
103105
"""Register a virtual subclass of an ABC."""
104-
if not isinstance(subclass, type):
106+
if not isinstance(subclass, (type, types.ClassType)):
105107
raise TypeError("Can only register classes")
106108
if issubclass(subclass, cls):
107109
return # Already a subclass

Misc/NEWS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,6 @@ Library
971971
position to the given argument, which goes against the tradition of
972972
ftruncate() and other truncation APIs. Patch by Pascal Chambon.
973973

974-
- UserDict is now a new-style class.
975-
976974
- Issue #7610: Reworked implementation of the internal ``zipfile.ZipExtFile``
977975
class used to represent files stored inside an archive. The new
978976
implementation is significantly faster and can be wrapped in a

0 commit comments

Comments
 (0)