Kaydet (Commit) bde67df0 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

keep UserDict an old-style class

Be generous in abc.py to allow this.
üst 3ceab01c
"""A more or less complete user-defined wrapper around dictionary objects.""" """A more or less complete user-defined wrapper around dictionary objects."""
class UserDict(object): class UserDict:
def __init__(self, dict=None, **kwargs): def __init__(self, dict=None, **kwargs):
self.data = {} self.data = {}
if dict is not None: if dict is not None:
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
"""Abstract Base Classes (ABCs) according to PEP 3119.""" """Abstract Base Classes (ABCs) according to PEP 3119."""
import types
# Instance of old-style class # Instance of old-style class
class _C: pass class _C: pass
...@@ -101,7 +103,7 @@ class ABCMeta(type): ...@@ -101,7 +103,7 @@ class ABCMeta(type):
def register(cls, subclass): def register(cls, subclass):
"""Register a virtual subclass of an ABC.""" """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") raise TypeError("Can only register classes")
if issubclass(subclass, cls): if issubclass(subclass, cls):
return # Already a subclass return # Already a subclass
......
...@@ -971,8 +971,6 @@ Library ...@@ -971,8 +971,6 @@ Library
position to the given argument, which goes against the tradition of position to the given argument, which goes against the tradition of
ftruncate() and other truncation APIs. Patch by Pascal Chambon. 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`` - Issue #7610: Reworked implementation of the internal ``zipfile.ZipExtFile``
class used to represent files stored inside an archive. The new class used to represent files stored inside an archive. The new
implementation is significantly faster and can be wrapped in a implementation is significantly faster and can be wrapped in a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment