summaryrefslogtreecommitdiff
path: root/Lib/bsddb/dbshelve.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-04 21:26:27 +0000
committerRaymond Hettinger <python@rcn.com>2008-02-04 21:26:27 +0000
commitd190f9c45e07caa77f8f79ac34560d41271a7c7b (patch)
tree7e2e70f6bcd043ed856d11739fba7de15b9fdfb8 /Lib/bsddb/dbshelve.py
parent3be449ae36cc0a11646dd8f6708e2cebddbe44bf (diff)
downloadcpython-git-d190f9c45e07caa77f8f79ac34560d41271a7c7b.tar.gz
In bsddb, replace UserDict.DictMixin with collections.MutableMapping.
I can't test this directly on my build, so letting the buildbots do it for me. If it fails, expect a reversion.
Diffstat (limited to 'Lib/bsddb/dbshelve.py')
-rw-r--r--Lib/bsddb/dbshelve.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py
index 8264f2d812..942ee17016 100644
--- a/Lib/bsddb/dbshelve.py
+++ b/Lib/bsddb/dbshelve.py
@@ -38,12 +38,12 @@ if sys.version_info[:3] >= (2, 3, 0):
HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL
def _dumps(object, protocol):
return pickle.dumps(object, protocol=protocol)
- from UserDict import DictMixin
+ from collections import MutableMapping
else:
HIGHEST_PROTOCOL = None
def _dumps(object, protocol):
return pickle.dumps(object, bin=protocol)
- class DictMixin: pass
+ class MutableMapping: pass
from . import db
@@ -90,7 +90,7 @@ def open(filename, flags=db.DB_CREATE, mode=0o660, filetype=db.DB_HASH,
class DBShelveError(db.DBError): pass
-class DBShelf(DictMixin):
+class DBShelf(MutableMapping):
"""A shelf to hold pickled objects, built upon a bsddb DB object. It
automatically pickles/unpickles data objects going to/from the DB.
"""
@@ -141,6 +141,8 @@ class DBShelf(DictMixin):
else:
return self.db.keys()
+ def __iter__(self):
+ return iter(self.keys())
def open(self, *args, **kwargs):
self.db.open(*args, **kwargs)